diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-09 13:34:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-09 13:34:27 +0000 |
commit | 4dbdc42d9e7c3968ff7f690d00680419c9b8cb0f (patch) | |
tree | 47c1d492e9c956c1cd2b74dbd3b9d8b0db44dc4e /t/t7602-merge-octopus-many.sh | |
parent | Initial commit. (diff) | |
download | git-4dbdc42d9e7c3968ff7f690d00680419c9b8cb0f.tar.xz git-4dbdc42d9e7c3968ff7f690d00680419c9b8cb0f.zip |
Adding upstream version 1:2.43.0.upstream/1%2.43.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 't/t7602-merge-octopus-many.sh')
-rwxr-xr-x | t/t7602-merge-octopus-many.sh | 108 |
1 files changed, 108 insertions, 0 deletions
diff --git a/t/t7602-merge-octopus-many.sh b/t/t7602-merge-octopus-many.sh new file mode 100755 index 0000000..3669d33 --- /dev/null +++ b/t/t7602-merge-octopus-many.sh @@ -0,0 +1,108 @@ +#!/bin/sh + +test_description='git merge + +Testing octopus merge with more than 25 refs.' + +TEST_PASSES_SANITIZE_LEAK=true +. ./test-lib.sh + +test_expect_success 'setup' ' + echo c0 > c0.c && + git add c0.c && + git commit -m c0 && + git tag c0 && + i=1 && + while test $i -le 30 + do + git reset --hard c0 && + echo c$i > c$i.c && + git add c$i.c && + git commit -m c$i && + git tag c$i && + i=$(expr $i + 1) || return 1 + done +' + +test_expect_success 'merge c1 with c2, c3, c4, ... c29' ' + git reset --hard c1 && + i=2 && + refs="" && + while test $i -le 30 + do + refs="$refs c$i" && + i=$(expr $i + 1) || return 1 + done && + git merge $refs && + test "$(git rev-parse c1)" != "$(git rev-parse HEAD)" && + i=1 && + while test $i -le 30 + do + test "$(git rev-parse c$i)" = "$(git rev-parse HEAD^$i)" && + i=$(expr $i + 1) || return 1 + done && + git diff --exit-code && + i=1 && + while test $i -le 30 + do + test -f c$i.c && + i=$(expr $i + 1) || return 1 + done +' + +cat >expected <<\EOF +Trying simple merge with c2 +Trying simple merge with c3 +Trying simple merge with c4 +Merge made by the 'octopus' strategy. + c2.c | 1 + + c3.c | 1 + + c4.c | 1 + + 3 files changed, 3 insertions(+) + create mode 100644 c2.c + create mode 100644 c3.c + create mode 100644 c4.c +EOF + +test_expect_success 'merge output uses pretty names' ' + git reset --hard c1 && + git merge c2 c3 c4 >actual && + test_cmp expected actual +' + +cat >expected <<\EOF +Merge made by the 'recursive' strategy. + c5.c | 1 + + 1 file changed, 1 insertion(+) + create mode 100644 c5.c +EOF + +test_expect_success 'merge reduces irrelevant remote heads' ' + if test "$GIT_TEST_MERGE_ALGORITHM" = ort + then + mv expected expected.tmp && + sed s/recursive/ort/ expected.tmp >expected && + rm expected.tmp + fi && + GIT_MERGE_VERBOSITY=0 git merge c4 c5 >actual && + test_cmp expected actual +' + +cat >expected <<\EOF +Fast-forwarding to: c1 +Trying simple merge with c2 +Merge made by the 'octopus' strategy. + c1.c | 1 + + c2.c | 1 + + 2 files changed, 2 insertions(+) + create mode 100644 c1.c + create mode 100644 c2.c +EOF + +test_expect_success 'merge fast-forward output uses pretty names' ' + git reset --hard c0 && + git merge c1 c2 >actual && + test_cmp expected actual +' + +test_done |