mirror of
https://github.com/git-for-windows/git.git
synced 2026-06-11 08:30:32 -05:00
Merge branch 'kk/merge-octopus-optim' into next
The logic to determine that branches in an octopus merge are independent has been optimized. * kk/merge-octopus-optim: merge: use repo_in_merge_bases for octopus up-to-date check
This commit is contained in:
@@ -1738,21 +1738,11 @@ int cmd_merge(int argc,
|
||||
struct commit_list *j;
|
||||
|
||||
for (j = remoteheads; j; j = j->next) {
|
||||
struct commit_list *common_one = NULL;
|
||||
struct commit *common_item;
|
||||
|
||||
/*
|
||||
* Here we *have* to calculate the individual
|
||||
* merge_bases again, otherwise "git merge HEAD^
|
||||
* HEAD^^" would be missed.
|
||||
*/
|
||||
if (repo_get_merge_bases(the_repository, head_commit,
|
||||
j->item, &common_one) < 0)
|
||||
int ret = repo_in_merge_bases(the_repository,
|
||||
j->item, head_commit);
|
||||
if (ret < 0)
|
||||
exit(128);
|
||||
|
||||
common_item = common_one->item;
|
||||
commit_list_free(common_one);
|
||||
if (!oideq(&common_item->object.oid, &j->item->object.oid)) {
|
||||
if (!ret) {
|
||||
up_to_date = 0;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -89,4 +89,14 @@ test_expect_success 'merge fast-forward octopus' '
|
||||
test "$expect" = "$current"
|
||||
'
|
||||
|
||||
test_expect_success 'merge octopus already up to date' '
|
||||
|
||||
git reset --hard c2 &&
|
||||
test_tick &&
|
||||
git merge c0 c1 &&
|
||||
expect=$(git rev-parse c2) &&
|
||||
current=$(git rev-parse HEAD) &&
|
||||
test "$expect" = "$current"
|
||||
'
|
||||
|
||||
test_done
|
||||
|
||||
Reference in New Issue
Block a user