t3404: use test_cmp_rev
There are a number of places where we compare two revisions with test $(git rev-parse rev1) = $(git rev-parse rev2) when these fail there's no indication what has gone wrong and you need to be running with `-x` to see where the test has failed. Lets use test_cmp_rev instead. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Phillip Wood committed
Dec 6, 2019 at 16:06 UTC
780308d060b2756ed52913ad2c1328c0d7049c05
1 file changed
+19
-19
t/t3404-rebase-interactive.sh
+19
-19
@@ -186,7 +186,7 @@ test_expect_success 'no changes are a nop' '
186
git checkout branch2 &&
187
git rebase -i F &&
188
test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" &&
189
- test $(git rev-parse I) = $(git rev-parse HEAD)
189
+ test_cmp_rev I HEAD
190
'
191
192
test_expect_success 'test the [branch] option' '
@@ -195,16 +195,16 @@ test_expect_success 'test the [branch] option' '
195
git commit -m "stop here" &&
196
git rebase -i F branch2 &&
197
test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch2" &&
198
- test $(git rev-parse I) = $(git rev-parse branch2) &&
199
- test $(git rev-parse I) = $(git rev-parse HEAD)
198
+ test_cmp_rev I branch2 &&
199
+ test_cmp_rev I HEAD
200
'
201
202
test_expect_success 'test --onto <branch>' '
203
git checkout -b test-onto branch2 &&
204
git rebase -i --onto branch1 F &&
205
test "$(git symbolic-ref -q HEAD)" = "refs/heads/test-onto" &&
206
- test $(git rev-parse HEAD^) = $(git rev-parse branch1) &&
207
- test $(git rev-parse I) = $(git rev-parse branch2)
206
+ test_cmp_rev HEAD^ branch1 &&
207
+ test_cmp_rev I branch2
208
'
209
210
test_expect_success 'rebase on top of a non-conflicting commit' '
@@ -213,12 +213,12 @@ test_expect_success 'rebase on top of a non-conflicting commit' '
213
git rebase -i branch2 &&
214
test file6 = $(git diff --name-only original-branch1) &&
215
test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch1" &&
216
- test $(git rev-parse I) = $(git rev-parse branch2) &&
217
- test $(git rev-parse I) = $(git rev-parse HEAD~2)
216
+ test_cmp_rev I branch2 &&
217
+ test_cmp_rev I HEAD~2
218
'
219
220
test_expect_success 'reflog for the branch shows state before rebase' '
221
- test $(git rev-parse branch1@{1}) = $(git rev-parse original-branch1)
221
+ test_cmp_rev branch1@{1} original-branch1
222
'
223
224
test_expect_success 'reflog for the branch shows correct finish message' '
@@ -278,7 +278,7 @@ test_expect_success 'show conflicted patch' '
278
279
test_expect_success 'abort' '
280
git rebase --abort &&
281
- test $(git rev-parse new-branch1) = $(git rev-parse HEAD) &&
281
+ test_cmp_rev new-branch1 HEAD &&
282
test "$(git symbolic-ref -q HEAD)" = "refs/heads/branch1" &&
283
test_path_is_missing .git/rebase-merge
284
'
@@ -321,7 +321,7 @@ test_expect_success 'retain authorship w/ conflicts' '
321
echo resolved >conflict &&
322
git add conflict &&
323
git rebase --continue &&
324
- test $(git rev-parse conflict-a^0) = $(git rev-parse HEAD^) &&
324
+ test_cmp_rev conflict-a^0 HEAD^ &&
325
git show >out &&
326
grep AttributeMe out
327
'
@@ -338,7 +338,7 @@ test_expect_success 'squash' '
338
git rebase -i --onto master HEAD~2
339
) &&
340
test B = $(cat file7) &&
341
- test $(git rev-parse HEAD^) = $(git rev-parse master)
341
+ test_cmp_rev HEAD^ master
342
'
343
344
test_expect_success 'retain authorship when squashing' '
@@ -397,9 +397,9 @@ test_expect_success REBASE_P 'preserve merges with -p' '
397
git update-index --refresh &&
398
git diff-files --quiet &&
399
git diff-index --quiet --cached HEAD -- &&
400
- test $(git rev-parse HEAD~6) = $(git rev-parse branch1) &&
401
- test $(git rev-parse HEAD~4^2) = $(git rev-parse to-be-preserved) &&
402
- test $(git rev-parse HEAD^^2^) = $(git rev-parse HEAD^^^) &&
400
+ test_cmp_rev HEAD~6 branch1 &&
401
+ test_cmp_rev HEAD~4^2 to-be-preserved &&
402
+ test_cmp_rev HEAD^^2^ HEAD^^^ &&
403
test $(git show HEAD~5:file1) = B &&
404
test $(git show HEAD~3:file1) = C &&
405
test $(git show HEAD:file1) = E &&
@@ -431,7 +431,7 @@ test_expect_success '--continue tries to commit' '
431
git add file1 &&
432
FAKE_COMMIT_MESSAGE="chouette!" git rebase --continue
433
) &&
434
- test $(git rev-parse HEAD^) = $(git rev-parse new-branch1) &&
434
+ test_cmp_rev HEAD^ new-branch1 &&
435
git show HEAD | grep chouette
436
'
437
@@ -738,7 +738,7 @@ test_expect_success 'do "noop" when there is nothing to cherry-pick' '
738
--author="Somebody else <somebody@else.com>" &&
739
test $(git rev-parse branch3) != $(git rev-parse branch4) &&
740
git rebase -i branch3 &&
741
- test $(git rev-parse branch3) = $(git rev-parse branch4)
741
+ test_cmp_rev branch3 branch4
742
743
'
744
@@ -797,7 +797,7 @@ test_expect_success 'rebase -i continue with unstaged submodule' '
797
test_must_fail git rebase -i submodule-base &&
798
git reset &&
799
git rebase --continue &&
800
- test $(git rev-parse submodule-base) = $(git rev-parse HEAD)
800
+ test_cmp_rev submodule-base HEAD
801
'
802
803
test_expect_success 'avoid unnecessary reset' '
@@ -820,7 +820,7 @@ test_expect_success 'reword' '
820
git rebase -i A &&
821
git show HEAD | grep "E changed" &&
822
test $(git rev-parse master) != $(git rev-parse HEAD) &&
823
- test $(git rev-parse master^) = $(git rev-parse HEAD^) &&
823
+ test_cmp_rev master^ HEAD^ &&
824
FAKE_LINES="1 2 reword 3 4" FAKE_COMMIT_MESSAGE="D changed" \
825
git rebase -i A &&
826
git show HEAD^ | grep "D changed" &&
@@ -884,7 +884,7 @@ test_expect_success 'always cherry-pick with --no-ff' '
884
git diff HEAD~$p original-no-ff-branch~$p > out &&
885
test_must_be_empty out
886
done &&
887
- test $(git rev-parse HEAD~3) = $(git rev-parse original-no-ff-branch~3) &&
887
+ test_cmp_rev HEAD~3 original-no-ff-branch~3 &&
888
git diff HEAD~3 original-no-ff-branch~3 > out &&
889
test_must_be_empty out
890
'