use parse_commit_or_die instead of segfaulting
[gitweb.git] / builtin / checkout.c
index 7025938ae30f2ce3104b27f66bf6e1f294edb810..88ab9480daccaa8ba4ecae8c7e4262ecc1b1f532 100644 (file)
@@ -796,7 +796,7 @@ static int switch_branches(const struct checkout_opts *opts,
                new->commit = old.commit;
                if (!new->commit)
                        die(_("You are on a branch yet to be born"));
-               parse_commit(new->commit);
+               parse_commit_or_die(new->commit);
        }
 
        ret = merge_working_tree(opts, &old, new, &writeout_error);
@@ -959,7 +959,7 @@ static int parse_branchname_arg(int argc, const char **argv,
                /* not a commit */
                *source_tree = parse_tree_indirect(rev);
        } else {
-               parse_commit(new->commit);
+               parse_commit_or_die(new->commit);
                *source_tree = new->commit->tree;
        }