2008-06-27 19:06:26 +02:00
|
|
|
#!/bin/sh
|
|
|
|
|
2008-09-03 10:59:33 +02:00
|
|
|
test_description='git merge
|
2008-06-27 19:06:26 +02:00
|
|
|
|
|
|
|
Testing octopus merge with more than 25 refs.'
|
|
|
|
|
|
|
|
. ./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 &&
|
2016-01-08 12:06:24 +01:00
|
|
|
i=$(expr $i + 1) || return 1
|
2008-06-27 19:06:26 +02:00
|
|
|
done
|
|
|
|
'
|
|
|
|
|
2008-07-07 19:24:20 +02:00
|
|
|
test_expect_success 'merge c1 with c2, c3, c4, ... c29' '
|
2008-06-27 19:06:26 +02:00
|
|
|
git reset --hard c1 &&
|
|
|
|
i=2 &&
|
|
|
|
refs="" &&
|
|
|
|
while test $i -le 30
|
|
|
|
do
|
|
|
|
refs="$refs c$i"
|
2016-01-08 12:06:24 +01:00
|
|
|
i=$(expr $i + 1)
|
2010-10-31 02:46:54 +01:00
|
|
|
done &&
|
2008-06-27 19:06:26 +02:00
|
|
|
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)" &&
|
2016-01-08 12:06:24 +01:00
|
|
|
i=$(expr $i + 1) || return 1
|
2008-06-27 19:06:26 +02:00
|
|
|
done &&
|
|
|
|
git diff --exit-code &&
|
|
|
|
i=1 &&
|
|
|
|
while test $i -le 30
|
|
|
|
do
|
|
|
|
test -f c$i.c &&
|
2016-01-08 12:06:24 +01:00
|
|
|
i=$(expr $i + 1) || return 1
|
2008-06-27 19:06:26 +02:00
|
|
|
done
|
|
|
|
'
|
|
|
|
|
2009-12-12 01:38:57 +01:00
|
|
|
cat >expected <<\EOF
|
|
|
|
Trying simple merge with c2
|
|
|
|
Trying simple merge with c3
|
|
|
|
Trying simple merge with c4
|
2011-05-25 21:43:59 +02:00
|
|
|
Merge made by the 'octopus' strategy.
|
2012-04-30 22:38:58 +02:00
|
|
|
c2.c | 1 +
|
|
|
|
c3.c | 1 +
|
|
|
|
c4.c | 1 +
|
2012-02-01 13:55:07 +01:00
|
|
|
3 files changed, 3 insertions(+)
|
2009-12-12 01:38:57 +01:00
|
|
|
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 &&
|
2021-02-11 02:53:53 +01:00
|
|
|
test_cmp expected actual
|
2009-12-12 01:38:57 +01:00
|
|
|
'
|
|
|
|
|
|
|
|
cat >expected <<\EOF
|
2012-02-13 12:48:56 +01:00
|
|
|
Merge made by the 'recursive' strategy.
|
2012-04-30 22:38:58 +02:00
|
|
|
c5.c | 1 +
|
2012-02-01 13:55:07 +01:00
|
|
|
1 file changed, 1 insertion(+)
|
2009-12-12 01:38:57 +01:00
|
|
|
create mode 100644 c5.c
|
|
|
|
EOF
|
|
|
|
|
2012-04-17 21:22:26 +02:00
|
|
|
test_expect_success 'merge reduces irrelevant remote heads' '
|
2020-10-26 18:01:41 +01:00
|
|
|
if test "$GIT_TEST_MERGE_ALGORITHM" = ort
|
|
|
|
then
|
|
|
|
mv expected expected.tmp &&
|
|
|
|
sed s/recursive/ort/ expected.tmp >expected &&
|
|
|
|
rm expected.tmp
|
|
|
|
fi &&
|
2012-02-13 12:48:56 +01:00
|
|
|
GIT_MERGE_VERBOSITY=0 git merge c4 c5 >actual &&
|
2021-02-11 02:53:53 +01:00
|
|
|
test_cmp expected actual
|
2009-12-12 01:38:57 +01:00
|
|
|
'
|
2009-12-12 01:38:58 +01:00
|
|
|
|
|
|
|
cat >expected <<\EOF
|
|
|
|
Fast-forwarding to: c1
|
|
|
|
Trying simple merge with c2
|
2011-05-25 21:43:59 +02:00
|
|
|
Merge made by the 'octopus' strategy.
|
2012-04-30 22:38:58 +02:00
|
|
|
c1.c | 1 +
|
|
|
|
c2.c | 1 +
|
2012-02-01 13:55:07 +01:00
|
|
|
2 files changed, 2 insertions(+)
|
2009-12-12 01:38:58 +01:00
|
|
|
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 &&
|
2021-02-11 02:53:53 +01:00
|
|
|
test_cmp expected actual
|
2009-12-12 01:38:58 +01:00
|
|
|
'
|
|
|
|
|
2008-06-27 19:06:26 +02:00
|
|
|
test_done
|