mirror of
https://github.com/git/git.git
synced 2024-11-06 09:13:01 +01:00
Merge branch 'sp/merge' (early part)
* 'sp/merge' (early part): Use merge-recursive in git-am -3. Allow merging bare trees in merge-recursive. Move better_branch_name above get_ref in merge-recursive.
This commit is contained in:
commit
9066f4ef2f
2 changed files with 23 additions and 17 deletions
|
@ -88,10 +88,12 @@ It does not apply to blobs recorded in its index."
|
|||
# This is not so wrong. Depending on which base we picked,
|
||||
# orig_tree may be wildly different from ours, but his_tree
|
||||
# has the same set of wildly different changes in parts the
|
||||
# patch did not touch, so resolve ends up canceling them,
|
||||
# patch did not touch, so recursive ends up canceling them,
|
||||
# saying that we reverted all those changes.
|
||||
|
||||
git-merge-resolve $orig_tree -- HEAD $his_tree || {
|
||||
eval GITHEAD_$his_tree='"$SUBJECT"'
|
||||
export GITHEAD_$his_tree
|
||||
git-merge-recursive $orig_tree -- HEAD $his_tree || {
|
||||
if test -d "$GIT_DIR/rr-cache"
|
||||
then
|
||||
git-rerere
|
||||
|
@ -99,6 +101,7 @@ It does not apply to blobs recorded in its index."
|
|||
echo Failed to merge in the changes.
|
||||
exit 1
|
||||
}
|
||||
unset GITHEAD_$his_tree
|
||||
}
|
||||
|
||||
prec=4
|
||||
|
|
|
@ -1248,21 +1248,6 @@ static int merge(struct commit *h1,
|
|||
return clean;
|
||||
}
|
||||
|
||||
static struct commit *get_ref(const char *ref)
|
||||
{
|
||||
unsigned char sha1[20];
|
||||
struct object *object;
|
||||
|
||||
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_COMMIT)
|
||||
return NULL;
|
||||
if (parse_commit((struct commit *)object))
|
||||
die("Could not parse commit '%s'", sha1_to_hex(object->sha1));
|
||||
return (struct commit *)object;
|
||||
}
|
||||
|
||||
static const char *better_branch_name(const char *branch)
|
||||
{
|
||||
static char githead_env[8 + 40 + 1];
|
||||
|
@ -1275,6 +1260,24 @@ static const char *better_branch_name(const char *branch)
|
|||
return name ? name : branch;
|
||||
}
|
||||
|
||||
static struct commit *get_ref(const char *ref)
|
||||
{
|
||||
unsigned char sha1[20];
|
||||
struct object *object;
|
||||
|
||||
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))
|
||||
die("Could not parse commit '%s'", sha1_to_hex(object->sha1));
|
||||
return (struct commit *)object;
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
static const char *bases[2];
|
||||
|
|
Loading…
Reference in a new issue