diff options
Diffstat (limited to 'builtin')
-rw-r--r-- | builtin/commit.c | 6 | ||||
-rw-r--r-- | builtin/fmt-merge-msg.c | 2 | ||||
-rw-r--r-- | builtin/merge.c | 7 |
3 files changed, 7 insertions, 8 deletions
diff --git a/builtin/commit.c b/builtin/commit.c index 1a653190b5..402eb5af53 100644 --- a/builtin/commit.c +++ b/builtin/commit.c @@ -1396,7 +1396,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix) if (get_sha1("HEAD", sha1)) current_head = NULL; else { - current_head = lookup_commit(sha1); + current_head = lookup_commit_or_die(sha1, "HEAD"); if (!current_head || parse_commit(current_head)) die(_("could not parse HEAD commit")); } @@ -1431,6 +1431,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix) pptr = &commit_list_insert(c->item, pptr)->next; } else if (whence == FROM_MERGE) { struct strbuf m = STRBUF_INIT; + struct commit *commit; FILE *fp; if (!reflog_msg) @@ -1444,7 +1445,8 @@ int cmd_commit(int argc, const char **argv, const char *prefix) unsigned char sha1[20]; if (get_sha1_hex(m.buf, sha1) < 0) die(_("Corrupt MERGE_HEAD file (%s)"), m.buf); - pptr = &commit_list_insert(lookup_commit(sha1), pptr)->next; + commit = lookup_commit_or_die(sha1, "MERGE_HEAD"); + pptr = &commit_list_insert(commit, pptr)->next; } fclose(fp); strbuf_release(&m); diff --git a/builtin/fmt-merge-msg.c b/builtin/fmt-merge-msg.c index 75816329d6..7e2f22589d 100644 --- a/builtin/fmt-merge-msg.c +++ b/builtin/fmt-merge-msg.c @@ -293,7 +293,7 @@ static int do_fmt_merge_msg(int merge_title, struct strbuf *in, struct commit *head; struct rev_info rev; - head = lookup_commit(head_sha1); + head = lookup_commit_or_die(head_sha1, "HEAD"); init_revisions(&rev, NULL); rev.commit_format = CMIT_FMT_ONELINE; rev.ignore_merges = 1; diff --git a/builtin/merge.c b/builtin/merge.c index f5eb3f549b..9567d60ba2 100644 --- a/builtin/merge.c +++ b/builtin/merge.c @@ -1036,11 +1036,8 @@ int cmd_merge(int argc, const char **argv, const char *prefix) branch += 11; if (!branch || is_null_sha1(head_sha1)) head_commit = NULL; - else { - head_commit = lookup_commit(head_sha1); - if (!head_commit) - die(_("could not parse HEAD")); - } + else + head_commit = lookup_commit_or_die(head_sha1, "HEAD"); git_config(git_merge_config, NULL); |