Skip to content

Commit ad6a599

Browse files
committed
t7406: fix misleading "rev-parse --max-count=1 HEAD"
The test happened to use "rev-parse --max-count=1 HEAD" consistently to prepare the expected output and the actual output, so the comparison between them gave us a correct success/failure because both output had irrelevant "--max-count=1" in it. But that is not an excuse to keep it broken. Replace it a more meaningful construct "rev-parse --verify HEAD". Noticed by Daniel Graña while working on his submodule tests. Signed-off-by: Junio C Hamano <[email protected]>
1 parent 15ffb7c commit ad6a599

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

t/t7406-submodule-update.sh

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ test_expect_success 'submodule update continues after checkout error' '
305305
git submodule init &&
306306
git commit -am "new_submodule" &&
307307
(cd submodule2 &&
308-
git rev-parse --max-count=1 HEAD > ../expect
308+
git rev-parse --verify HEAD >../expect
309309
) &&
310310
(cd submodule &&
311311
test_commit "update_submodule" file
@@ -322,7 +322,7 @@ test_expect_success 'submodule update continues after checkout error' '
322322
git checkout HEAD^ &&
323323
test_must_fail git submodule update &&
324324
(cd submodule2 &&
325-
git rev-parse --max-count=1 HEAD > ../actual
325+
git rev-parse --verify HEAD >../actual
326326
) &&
327327
test_cmp expect actual
328328
)
@@ -351,7 +351,7 @@ test_expect_success 'submodule update continues after recursive checkout error'
351351
test_commit "update_submodule_again_again" file
352352
) &&
353353
(cd submodule2 &&
354-
git rev-parse --max-count=1 HEAD > ../expect &&
354+
git rev-parse --verify HEAD >../expect &&
355355
test_commit "update_submodule2_again" file
356356
) &&
357357
git add submodule &&
@@ -366,7 +366,7 @@ test_expect_success 'submodule update continues after recursive checkout error'
366366
) &&
367367
test_must_fail git submodule update --recursive &&
368368
(cd submodule2 &&
369-
git rev-parse --max-count=1 HEAD > ../actual
369+
git rev-parse --verify HEAD >../actual
370370
) &&
371371
test_cmp expect actual
372372
)
@@ -398,12 +398,12 @@ test_expect_success 'submodule update exit immediately in case of merge conflict
398398
) &&
399399
git checkout HEAD^ &&
400400
(cd submodule2 &&
401-
git rev-parse --max-count=1 HEAD > ../expect
401+
git rev-parse --verify HEAD >../expect
402402
) &&
403403
git config submodule.submodule.update merge &&
404404
test_must_fail git submodule update &&
405405
(cd submodule2 &&
406-
git rev-parse --max-count=1 HEAD > ../actual
406+
git rev-parse --verify HEAD >../actual
407407
) &&
408408
test_cmp expect actual
409409
)
@@ -432,12 +432,12 @@ test_expect_success 'submodule update exit immediately after recursive rebase er
432432
) &&
433433
git checkout HEAD^ &&
434434
(cd submodule2 &&
435-
git rev-parse --max-count=1 HEAD > ../expect
435+
git rev-parse --verify HEAD >../expect
436436
) &&
437437
git config submodule.submodule.update rebase &&
438438
test_must_fail git submodule update &&
439439
(cd submodule2 &&
440-
git rev-parse --max-count=1 HEAD > ../actual
440+
git rev-parse --verify HEAD >../actual
441441
) &&
442442
test_cmp expect actual
443443
)

0 commit comments

Comments
 (0)