rebase: allow --skip to work with --merge
Now that we control the merge base selection, we won't be forced into rolling things in that we wanted to skip beforehand. Also, add a test to ensure this all works as intended. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Eric Wong committed
Jun 24, 2006 at 18:29 UTC
d5e673b60be2eb99153276366b6b5ff3277805df
3 files changed
+73
-2
Documentation/git-rebase.txt
-1
@@ -108,7 +108,6 @@ OPTIONS
108
109
--skip::
110
Restart the rebasing process by skipping the current patch.
111
- This does not work with the --merge option.
111
112
--merge::
113
Use merging strategies to rebase. When the recursive (default) merge
git-rebase.sh
+12
-1
@@ -137,7 +137,18 @@ do
137
--skip)
138
if test -d "$dotest"
139
then
140
- die "--skip is not supported when using --merge"
140
+ prev_head="`cat $dotest/prev_head`"
141
+ end="`cat $dotest/end`"
142
+ msgnum="`cat $dotest/msgnum`"
143
+ msgnum=$(($msgnum + 1))
144
+ onto="`cat $dotest/onto`"
145
+ while test "$msgnum" -le "$end"
146
+ do
147
+ call_merge "$msgnum"
148
+ continue_merge
149
+ done
150
+ finish_rb_merge
151
+ exit
152
fi
153
git am -3 --skip --resolvemsg="$RESOLVEMSG"
154
exit
t/t3403-rebase-skip.sh
new
+61
@@ -0,0 +1,61 @@
1
+#!/bin/sh
2
+#
3
+# Copyright (c) 2006 Eric Wong
4
+#
5
+
6
+test_description='git rebase --merge --skip tests'
7
+
8
+. ./test-lib.sh
9
+
10
+# we assume the default git-am -3 --skip strategy is tested independently
11
+# and always works :)
12
+
13
+if test "$no_python"; then
14
+ echo "Skipping: no python => no recursive merge"
15
+ test_done
16
+ exit 0
17
+fi
18
+
19
+test_expect_success setup '
20
+ echo hello > hello &&
21
+ git add hello &&
22
+ git commit -m "hello" &&
23
+ git branch skip-reference &&
24
+
25
+ echo world >> hello &&
26
+ git commit -a -m "hello world" &&
27
+ echo goodbye >> hello &&
28
+ git commit -a -m "goodbye" &&
29
+
30
+ git checkout -f skip-reference &&
31
+ echo moo > hello &&
32
+ git commit -a -m "we should skip this" &&
33
+ echo moo > cow &&
34
+ git add cow &&
35
+ git commit -m "this should not be skipped" &&
36
+ git branch pre-rebase skip-reference &&
37
+ git branch skip-merge skip-reference
38
+ '
39
+
40
+test_expect_failure 'rebase with git am -3 (default)' 'git rebase master'
41
+
42
+test_expect_success 'rebase --skip with am -3' '
43
+ git reset --hard HEAD &&
44
+ git rebase --skip
45
+ '
46
+test_expect_success 'checkout skip-merge' 'git checkout -f skip-merge'
47
+
48
+test_expect_failure 'rebase with --merge' 'git rebase --merge master'
49
+
50
+test_expect_success 'rebase --skip with --merge' '
51
+ git reset --hard HEAD &&
52
+ git rebase --skip
53
+ '
54
+
55
+test_expect_success 'merge and reference trees equal' \
56
+ 'test -z "`git-diff-tree skip-merge skip-reference`"'
57
+
58
+test_debug 'gitk --all & sleep 1'
59
+
60
+test_done
61
+