wrap git's main usage string.
[alt-git.git] / t / t6029-merge-subtree.sh
blob5bbfa44e8d9ee3eebb18eb07e93380c802741a18
1 #!/bin/sh
3 test_description='subtree merge strategy'
5 . ./test-lib.sh
7 test_expect_success setup '
9 s="1 2 3 4 5 6 7 8"
10 for i in $s; do echo $i; done >hello &&
11 git add hello &&
12 git commit -m initial &&
13 git checkout -b side &&
14 echo >>hello world &&
15 git add hello &&
16 git commit -m second &&
17 git checkout master &&
18 for i in mundo $s; do echo $i; done >hello &&
19 git add hello &&
20 git commit -m master
24 test_expect_success 'subtree available and works like recursive' '
26 git merge -s subtree side &&
27 for i in mundo $s world; do echo $i; done >expect &&
28 test_cmp expect hello
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"
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 &&
57 echo "100644 $o1 0 git-gui/git-gui.sh"
58 echo "100644 $o2 0 git.c"
59 ) >expected &&
60 test_cmp expected actual
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 &&
73 echo "100644 $o3 0 git-gui/git-gui.sh"
74 echo "100644 $o2 0 git.c"
75 ) >expected &&
76 test_cmp expected actual
79 test_done