18
test_rebase_same_head () {
19
status="$1" &&
20
shift &&
21
- test_expect_$status "git rebase $* with $changes is no-op" "
21
+ what="$1" &&
22
+ shift &&
23
+ cmp="$1" &&
24
+ shift &&
25
+ test_expect_$status "git rebase $* with $changes is $what" "
26
oldhead=\$(git rev-parse HEAD) &&
27
test_when_finished 'git reset --hard \$oldhead' &&
24
- git rebase $* &&
28
+ git rebase $* >stdout &&
29
+ if test $what = work
30
+ then
31
+ test_i18ngrep 'rewinding head' stdout
32
+ elif test $what = noop
33
+ then
34
+ test_i18ngrep 'is up to date' stdout
35
+ fi &&
36
newhead=\$(git rev-parse HEAD) &&
26
- test_cmp_rev \$oldhead \$newhead
37
+ if test $cmp = same
38
+ then
39
+ test_cmp_rev \$oldhead \$newhead
40
+ elif test $cmp = diff
41
+ then
42
+ ! test_cmp_rev \$oldhead \$newhead
43
+ fi
44
"
45
}
46
47
changes='no changes'
31
-test_rebase_same_head success
32
-test_rebase_same_head success master
33
-test_rebase_same_head success --onto B B
34
-test_rebase_same_head success --onto B... B
35
-test_rebase_same_head success --onto master... master
36
-test_rebase_same_head success --no-fork-point
37
-test_rebase_same_head success --fork-point master
38
-test_rebase_same_head failure --fork-point --onto B B
39
-test_rebase_same_head failure --fork-point --onto B... B
40
-test_rebase_same_head success --fork-point --onto master... master
48
+test_rebase_same_head success work same
49
+test_rebase_same_head success noop same master
50
+test_rebase_same_head success noop same --onto B B
51
+test_rebase_same_head success noop same --onto B... B
52
+test_rebase_same_head success noop same --onto master... master
53
+test_rebase_same_head success noop same --no-fork-point
54
+test_rebase_same_head success work same --fork-point master
55
+test_rebase_same_head failure noop same --fork-point --onto B B
56
+test_rebase_same_head failure work same --fork-point --onto B... B
57
+test_rebase_same_head success work same --fork-point --onto master... master
58
42
-test_expect_success 'add work to side' '
59
+test_expect_success 'add work same to side' '
60
test_commit E
61
'
62
63
changes='our changes'
47
-test_rebase_same_head success
48
-test_rebase_same_head success master
49
-test_rebase_same_head success --onto B B
50
-test_rebase_same_head success --onto B... B
51
-test_rebase_same_head success --onto master... master
52
-test_rebase_same_head success --no-fork-point
53
-test_rebase_same_head success --fork-point master
54
-test_rebase_same_head failure --fork-point --onto B B
55
-test_rebase_same_head failure --fork-point --onto B... B
56
-test_rebase_same_head success --fork-point --onto master... master
64
+test_rebase_same_head success work same
65
+test_rebase_same_head success noop same master
66
+test_rebase_same_head success noop same --onto B B
67
+test_rebase_same_head success noop same --onto B... B
68
+test_rebase_same_head success noop same --onto master... master
69
+test_rebase_same_head success noop same --no-fork-point
70
+test_rebase_same_head success work same --fork-point master
71
+test_rebase_same_head failure work same --fork-point --onto B B
72
+test_rebase_same_head failure work same --fork-point --onto B... B
73
+test_rebase_same_head success work same --fork-point --onto master... master
74
58
-test_expect_success 'add work to upstream' '
75
+test_expect_success 'add work same to upstream' '
76
git checkout master &&
77
test_commit F &&
78
git checkout side
79
'
80
81
changes='our and their changes'
65
-test_rebase_same_head success --onto B B
66
-test_rebase_same_head success --onto B... B
67
-test_rebase_same_head failure --onto master... master
68
-test_rebase_same_head failure --fork-point --onto B B
69
-test_rebase_same_head failure --fork-point --onto B... B
70
-test_rebase_same_head failure --fork-point --onto master... master
82
+test_rebase_same_head success noop same --onto B B
83
+test_rebase_same_head success noop same --onto B... B
84
+test_rebase_same_head failure work same --onto master... master
85
+test_rebase_same_head failure work same --fork-point --onto B B
86
+test_rebase_same_head failure work same --fork-point --onto B... B
87
+test_rebase_same_head failure work same --fork-point --onto master... master
88
89
test_done