From 833abdc9327f60dff771273095074ae734513ab6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kiedrowicz?= Date: Mon, 13 Feb 2012 12:48:56 +0100 Subject: merge tests: octopus with redundant parents MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This happens when git merge is run to merge multiple commits that are descendants of current HEAD (or are HEAD). We've hit this while updating master to origin/master but accidentaly we called (while being on master): $ git merge master origin/master Here is a minimal testcase: $ git init a && cd a $ echo a >a && git add a $ git commit -minitial $ echo b >a && git add a $ git commit -msecond $ git checkout master^ $ git merge master master Fast-forwarding to: master Already up-to-date with master Merge made by the 'octopus' strategy. a | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) $ git cat-file commit HEAD tree eebfed94e75e7760540d1485c740902590a00332 parent bd679e85202280b263e20a57639a142fa14c2c64 author Michał Kiedrowicz 1329132996 +0100 committer Michał Kiedrowicz 1329132996 +0100 Merge branches 'master' and 'master' into HEAD Signed-off-by: Michał Kiedrowicz Signed-off-by: Junio C Hamano --- t/t7602-merge-octopus-many.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 't/t7602-merge-octopus-many.sh') diff --git a/t/t7602-merge-octopus-many.sh b/t/t7602-merge-octopus-many.sh index 5783ebf3ab..83e917b918 100755 --- a/t/t7602-merge-octopus-many.sh +++ b/t/t7602-merge-octopus-many.sh @@ -70,17 +70,15 @@ test_expect_success 'merge output uses pretty names' ' ' cat >expected <<\EOF -Already up-to-date with c4 -Trying simple merge with c5 -Merge made by the 'octopus' strategy. +Merge made by the 'recursive' strategy. c5.c | 1 + 1 file changed, 1 insertion(+) create mode 100644 c5.c EOF -test_expect_success 'merge up-to-date output uses pretty names' ' - git merge c4 c5 >actual && - test_cmp actual expected +test_expect_failure 'merge reduces irrelevant remote heads' ' + GIT_MERGE_VERBOSITY=0 git merge c4 c5 >actual && + test_cmp expected actual ' cat >expected <<\EOF -- cgit v1.2.3 From e78cbf8cbb61edfbdef5d33262f9b8cf02a3afca Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Tue, 17 Apr 2012 12:22:26 -0700 Subject: builtin/merge.c: reduce parents early Instead of waiting until we record the parents of resulting merge, reduce redundant parents (including our HEAD) immediately after reading them. The change to t7602 illustrates the essence of the effect of this change. The octopus merge strategy used to be fed with redundant commits only to discard them as "up-to-date", but we no longer feed such redundant commits to it and the affected test degenerates to a regular two-head merge. And obviously the known-to-be-broken test in t6028 is now fixed. Signed-off-by: Junio C Hamano --- t/t7602-merge-octopus-many.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/t7602-merge-octopus-many.sh') diff --git a/t/t7602-merge-octopus-many.sh b/t/t7602-merge-octopus-many.sh index 83e917b918..7117b57ccc 100755 --- a/t/t7602-merge-octopus-many.sh +++ b/t/t7602-merge-octopus-many.sh @@ -76,7 +76,7 @@ Merge made by the 'recursive' strategy. create mode 100644 c5.c EOF -test_expect_failure 'merge reduces irrelevant remote heads' ' +test_expect_success 'merge reduces irrelevant remote heads' ' GIT_MERGE_VERBOSITY=0 git merge c4 c5 >actual && test_cmp expected actual ' -- cgit v1.2.3