Skip to content

Commit 419e383

Browse files
Miklos Vajnagitster
authored andcommitted
Improve t6029 to check the real "subtree" case
t6029 already checks if subtree available and works like recursive. This patch adds code to test test the extra functionality the subtree merge strategy provides. Signed-off-by: Miklos Vajna <vmiklos@frugalware.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 39fe578 commit 419e383

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

t/t6029-merge-subtree.sh

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,51 @@ test_expect_success 'subtree available and works like recursive' '
2929
3030
'
3131

32+
test_expect_success 'setup' '
33+
mkdir git-gui &&
34+
cd git-gui &&
35+
git init &&
36+
echo git-gui > git-gui.sh &&
37+
o1=$(git hash-object git-gui.sh) &&
38+
git add git-gui.sh &&
39+
git commit -m "initial git-gui" &&
40+
cd .. &&
41+
mkdir git &&
42+
cd git &&
43+
git init &&
44+
echo git >git.c &&
45+
o2=$(git hash-object git.c) &&
46+
git add git.c &&
47+
git commit -m "initial git"
48+
'
49+
50+
test_expect_success 'initial merge' '
51+
git remote add -f gui ../git-gui &&
52+
git merge -s ours --no-commit gui/master &&
53+
git read-tree --prefix=git-gui/ -u gui/master &&
54+
git commit -m "Merge git-gui as our subdirectory" &&
55+
git ls-files -s >actual &&
56+
(
57+
echo "100644 $o1 0 git-gui/git-gui.sh"
58+
echo "100644 $o2 0 git.c"
59+
) >expected &&
60+
git diff -u expected actual
61+
'
62+
63+
test_expect_success 'merge update' '
64+
cd ../git-gui &&
65+
echo git-gui2 > git-gui.sh &&
66+
o3=$(git hash-object git-gui.sh) &&
67+
git add git-gui.sh &&
68+
git commit -m "update git-gui" &&
69+
cd ../git &&
70+
git pull -s subtree gui master &&
71+
git ls-files -s >actual &&
72+
(
73+
echo "100644 $o3 0 git-gui/git-gui.sh"
74+
echo "100644 $o2 0 git.c"
75+
) >expected &&
76+
git diff -u expected actual
77+
'
78+
3279
test_done

0 commit comments

Comments
 (0)