Skip to content

Commit

Permalink
Merge branch 'nd/maint-autofix-tag-in-head' into maint
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
Junio C Hamano committed Oct 21, 2011
2 parents e63f87a + baf18fc commit d25a265
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 65 deletions.
6 changes: 4 additions & 2 deletions builtin/commit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1392,7 +1392,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"));
}
Expand Down Expand Up @@ -1424,6 +1424,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)
Expand All @@ -1437,7 +1438,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);
Expand Down
2 changes: 1 addition & 1 deletion builtin/fmt-merge-msg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Loading

0 comments on commit d25a265

Please sign in to comment.