3 test_description='rebase interactive does not rebase'
7 test_expect_success 'setup' '
10 git commit -m "setup" &&
11 git clone ./. server &&
12 rm -fr server/.git/hooks &&
13 git remote add origin ./server &&
14 git config --add branch.master.remote origin &&
15 git config --add branch.master.merge refs/heads/master &&
18 git checkout -b stable master &&
19 echo "setup.stable" >a &&
20 git commit -a -m "stable" &&
21 git push origin stable
24 # A --C------ <-- origin/stable
26 # B -- D -- E -- F <-- origin/topic2
28 # g -- h ------- i <-- topic2
32 # merge-base(F, h) has two options: B and C
34 test_expect_success 'merging in stable with tricky double baserev does not fool the script' '
35 # B: start our topic2 branch, and share it
36 git checkout -b topic2 origin/stable &&
37 git config --add branch.topic2.merge refs/heads/topic2 &&
38 echo "commit B" >a.topic2 &&
40 git commit -m "commit B created topic2" &&
41 git push origin topic2 &&
43 # C: now, separately, move ahead stable, and share it
46 git commit -a -m "commit C moved stable" &&
47 git push origin stable &&
49 # D: have another client commit (in this case, it is the server, but close enough) moves topic2
51 git checkout topic2 &&
52 echo "commit D continuing topic2" >a.client2 &&
54 git commit -m "commit D by client2" &&
56 # E: the same other client merges the moved stable
59 # F: the same other client moves topic2 again
60 echo "commit F" >a.client2 &&
61 git commit -a -m "commit F by client2" &&
62 F_hash=$(git rev-parse HEAD) &&
65 # g: now locally merge in the moved stable (even though our topic2 is out of date)
66 git checkout topic2 &&
68 g_hash=$(git rev-parse HEAD) &&
70 # h: advance local topic2
71 echo "commit H" >a.topic2 &&
72 git commit -a -m "commit H continues local fork" &&
73 h_hash=$(git rev-parse HEAD) &&
75 # i: make a new merge commit
76 git pull --no-rebase &&
77 i_hash=$(git rev-parse HEAD) &&
79 # Watch merge rejected as something that should get rebased
80 # ! git push origin topic2
81 test "$i_hash $h_hash $F_hash" = "$(git rev-list --parents --no-walk HEAD)"
83 # Now fix it the merge by rebasing it
84 git reset --hard ORIG_HEAD &&
85 GIT_EDITOR=: git rebase -i -p origin/topic2 &&
86 h2_hash=$(git rev-parse HEAD) &&
89 # test "$h2_hash $F_hash" = "$(git rev-list --parents --no-walk HEAD)"
91 test "$h_hash $g_hash" = "$(git rev-list --parents --no-walk HEAD)"
92 # Where did $F_hash go?