Extend merge-subtree tests to test -Xsubtree=dir.
This tests the configurable -Xsubtree feature of merge-recursive. Signed-off-by: Avery Pennarun <apenwarr@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Avery Pennarun committed
Nov 25, 2009 at 21:23 UTC
e3cba962b172804ca1cab82801d94858154bd8cc
1 file changed
+46
-1
t/t6029-merge-subtree.sh
+46
-1
@@ -52,6 +52,7 @@ test_expect_success 'initial merge' '
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 checkout -b work &&
56
git ls-files -s >actual &&
57
(
58
echo "100644 $o1 0 git-gui/git-gui.sh"
@@ -65,9 +66,10 @@ test_expect_success 'merge update' '
66
echo git-gui2 > git-gui.sh &&
67
o3=$(git hash-object git-gui.sh) &&
68
git add git-gui.sh &&
69
+ git checkout -b master2 &&
70
git commit -m "update git-gui" &&
71
cd ../git &&
70
- git pull -s subtree gui master &&
72
+ git pull -s subtree gui master2 &&
73
git ls-files -s >actual &&
74
(
75
echo "100644 $o3 0 git-gui/git-gui.sh"
@@ -76,4 +78,47 @@ test_expect_success 'merge update' '
78
test_cmp expected actual
79
'
80
81
+test_expect_success 'initial ambiguous subtree' '
82
+ cd ../git &&
83
+ git reset --hard master &&
84
+ git checkout -b master2 &&
85
+ git merge -s ours --no-commit gui/master &&
86
+ git read-tree --prefix=git-gui2/ -u gui/master &&
87
+ git commit -m "Merge git-gui2 as our subdirectory" &&
88
+ git checkout -b work2 &&
89
+ git ls-files -s >actual &&
90
+ (
91
+ echo "100644 $o1 0 git-gui/git-gui.sh"
92
+ echo "100644 $o1 0 git-gui2/git-gui.sh"
93
+ echo "100644 $o2 0 git.c"
94
+ ) >expected &&
95
+ test_cmp expected actual
96
+'
97
+
98
+test_expect_success 'merge using explicit' '
99
+ cd ../git &&
100
+ git reset --hard master2 &&
101
+ git pull -Xsubtree=git-gui gui master2 &&
102
+ git ls-files -s >actual &&
103
+ (
104
+ echo "100644 $o3 0 git-gui/git-gui.sh"
105
+ echo "100644 $o1 0 git-gui2/git-gui.sh"
106
+ echo "100644 $o2 0 git.c"
107
+ ) >expected &&
108
+ test_cmp expected actual
109
+'
110
+
111
+test_expect_success 'merge2 using explicit' '
112
+ cd ../git &&
113
+ git reset --hard master2 &&
114
+ git pull -Xsubtree=git-gui2 gui master2 &&
115
+ git ls-files -s >actual &&
116
+ (
117
+ echo "100644 $o1 0 git-gui/git-gui.sh"
118
+ echo "100644 $o3 0 git-gui2/git-gui.sh"
119
+ echo "100644 $o2 0 git.c"
120
+ ) >expected &&
121
+ test_cmp expected actual
122
+'
123
+
124
test_done