summaryrefslogtreecommitdiff
path: root/builtin/merge.c
diff options
context:
space:
mode:
authorLibravatar Nguyễn Thái Ngọc Duy <pclouds@gmail.com>2011-09-17 21:57:45 +1000
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-09-18 14:11:40 -0700
commitbaf18fc261ca475343fe3cb9cd2c0dded4bc1bb7 (patch)
tree666474a67f25d9906b2eace5692d1613beab21a6 /builtin/merge.c
parentmerge: remove global variable head[] (diff)
downloadtgif-baf18fc261ca475343fe3cb9cd2c0dded4bc1bb7.tar.xz
Accept tags in HEAD or MERGE_HEAD
HEAD and MERGE_HEAD (among other branch tips) should never hold a tag. That can only be caused by broken tools and is cumbersome to fix by an end user with: $ git update-ref HEAD $(git rev-parse HEAD^{commit}) which may look like a magic to a new person. Be easy, warn users (so broken tools can be fixed if they bother to report) and move on. Be robust, if the given SHA-1 cannot be resolved to a commit object, die (therefore return value is always valid). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/merge.c')
-rw-r--r--builtin/merge.c7
1 files changed, 2 insertions, 5 deletions
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);