git-commit.sh: convert run_status to a C builtin
[git.git] / t / t3402-rebase-merge.sh
blobd34c6cf6f3143bac81b69f79329d2d893e379c39
1 #!/bin/sh
3 # Copyright (c) 2006 Junio C Hamano
6 test_description='git rebase --merge test'
8 . ./test-lib.sh
10 if test "$no_python"; then
11 echo "Skipping: no python => no recursive merge"
12 test_done
13 exit 0
16 T="A quick brown fox
17 jumps over the lazy dog."
18 for i in 1 2 3 4 5 6 7 8 9 10
20 echo "$i $T"
21 done >original
23 test_expect_success setup '
24 git add original &&
25 git commit -m"initial" &&
26 git branch side &&
27 echo "11 $T" >>original &&
28 git commit -a -m"master updates a bit." &&
30 echo "12 $T" >>original &&
31 git commit -a -m"master updates a bit more." &&
33 git checkout side &&
34 (echo "0 $T" ; cat original) >renamed &&
35 git add renamed &&
36 git update-index --force-remove original &&
37 git commit -a -m"side renames and edits." &&
39 tr "[a-z]" "[A-Z]" <original >newfile &&
40 git add newfile &&
41 git commit -a -m"side edits further." &&
43 tr "[a-m]" "[A-M]" <original >newfile &&
44 rm -f original &&
45 git commit -a -m"side edits once again." &&
47 git branch test-rebase side &&
48 git branch test-rebase-pick side &&
49 git branch test-reference-pick side &&
50 git checkout -b test-merge side
53 test_expect_success 'reference merge' '
54 git merge -s recursive "reference merge" HEAD master
57 test_expect_success rebase '
58 git checkout test-rebase &&
59 git rebase --merge master
62 test_expect_success 'merge and rebase should match' '
63 git diff-tree -r test-rebase test-merge >difference &&
64 if test -s difference
65 then
66 cat difference
67 (exit 1)
68 else
69 echo happy
73 test_expect_success 'rebase the other way' '
74 git reset --hard master &&
75 git rebase --merge side
78 test_expect_success 'merge and rebase should match' '
79 git diff-tree -r test-rebase test-merge >difference &&
80 if test -s difference
81 then
82 cat difference
83 (exit 1)
84 else
85 echo happy
89 test_expect_success 'picking rebase' '
90 git reset --hard side &&
91 git rebase --merge --onto master side^^ &&
92 mb=$(git merge-base master HEAD) &&
93 if test "$mb" = "$(git rev-parse master)"
94 then
95 echo happy
96 else
97 git show-branch
98 (exit 1)
99 fi &&
100 f=$(git diff-tree --name-only HEAD^ HEAD) &&
101 g=$(git diff-tree --name-only HEAD^^ HEAD^) &&
102 case "$f,$g" in
103 newfile,newfile)
104 echo happy ;;
106 echo "$f"
107 echo "$g"
108 (exit 1)
109 esac
112 test_done