Skip to content
/ git Public
forked from git/git

Commit

Permalink
Allow merging bare trees in merge-recursive.
Browse files Browse the repository at this point in the history
To support wider use cases, such as from within `git am -3`, the
merge-recursive utility needs to accept not just commit-ish but
also tree-ish as arguments on its command line.

If given a tree-ish then merge-recursive will create a virtual commit
wrapping it, with the subject of the commit set to the best name we
can derive for that tree, which is either the command line string
(probably the SHA1), or whatever string appears in GITHEAD_*.

Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
spearce authored and Junio C Hamano committed Dec 29, 2006
1 parent 7ba3c07 commit a970e84
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions merge-recursive.c
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,9 @@ static struct commit *get_ref(const char *ref)
if (get_sha1(ref, sha1))
die("Could not resolve ref '%s'", ref);
object = deref_tag(parse_object(sha1), ref, strlen(ref));
if (object->type == OBJ_TREE)
return make_virtual_commit((struct tree*)object,
better_branch_name(ref));
if (object->type != OBJ_COMMIT)
return NULL;
if (parse_commit((struct commit *)object))
Expand Down

0 comments on commit a970e84

Please sign in to comment.