Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Kiedrowicz <michal.kiedrowicz@gmail.com>2012-02-13 15:48:56 +0400
committerJunio C Hamano <gitster@pobox.com>2012-04-18 04:13:45 +0400
commit833abdc9327f60dff771273095074ae734513ab6 (patch)
tree57de52156afb16ed091d5cc933d9b3e08f8456aa /t/t7603-merge-reduce-heads.sh
parent6eab5f2f14806cf6a7b665d96766a59c13a41f4b (diff)
merge tests: octopus with redundant parents
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 <michal.kiedrowicz@gmail.com> 1329132996 +0100 committer Michał Kiedrowicz <michal.kiedrowicz@gmail.com> 1329132996 +0100 Merge branches 'master' and 'master' into HEAD Signed-off-by: Michał Kiedrowicz <michal.kiedrowicz@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t7603-merge-reduce-heads.sh')
-rwxr-xr-xt/t7603-merge-reduce-heads.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t7603-merge-reduce-heads.sh b/t/t7603-merge-reduce-heads.sh
index 7e17eb490d..f2934e8c25 100755
--- a/t/t7603-merge-reduce-heads.sh
+++ b/t/t7603-merge-reduce-heads.sh
@@ -113,4 +113,23 @@ test_expect_success 'verify merge result' '
test $(git rev-parse HEAD^1) = $(git rev-parse E2) &&
test $(git rev-parse HEAD^2) = $(git rev-parse I2)
'
+
+test_expect_success 'fast-forward to redundant refs' '
+ git reset --hard c0 &&
+ git merge c4 c5
+'
+
+test_expect_failure 'verify merge result' '
+ test $(git rev-parse HEAD) = $(git rev-parse c5)
+'
+
+test_expect_success 'merge up-to-date redundant refs' '
+ git reset --hard c5 &&
+ git merge c0 c4
+'
+
+test_expect_success 'verify merge result' '
+ test $(git rev-parse HEAD) = $(git rev-parse c5)
+'
+
test_done