Merge branch 'nd/maint-autofix-tag-in-head' into maint

* nd/maint-autofix-tag-in-head:
  Accept tags in HEAD or MERGE_HEAD
  merge: remove global variable head[]
  merge: use return value of resolve_ref() to determine if HEAD is invalid
  merge: keep stash[] a local variable

Conflicts:
	builtin/merge.c
This commit is contained in:
Junio C Hamano
2011-10-21 10:49:26 -07:00
7 changed files with 93 additions and 65 deletions

View File

@ -1011,10 +1011,12 @@ static void prepare_show_merge(struct rev_info *revs)
const char **prune = NULL;
int i, prune_num = 1; /* counting terminating NULL */
if (get_sha1("HEAD", sha1) || !(head = lookup_commit(sha1)))
if (get_sha1("HEAD", sha1))
die("--merge without HEAD?");
if (get_sha1("MERGE_HEAD", sha1) || !(other = lookup_commit(sha1)))
head = lookup_commit_or_die(sha1, "HEAD");
if (get_sha1("MERGE_HEAD", sha1))
die("--merge without MERGE_HEAD?");
other = lookup_commit_or_die(sha1, "MERGE_HEAD");
add_pending_object(revs, &head->object, "HEAD");
add_pending_object(revs, &other->object, "MERGE_HEAD");
bases = get_merge_bases(head, other, 1);