From 05880b02221dc8da136e9febfa7853ad822b1ee1 Mon Sep 17 00:00:00 2001 From: Johannes Sixt Date: Fri, 20 Apr 2012 08:25:09 +0200 Subject: [PATCH] t9300-fast-import: avoid 'exit' in test_expect_success snippets Exiting from a for-loop early using '|| break' does not propagate the failure code, and for this reason, the tests used just 'exit'. But this ends the test script with 'FATAL: Unexpected exit code 1' in the case of a failed test. Fix this by moving the loop into a shell function, from which we can simply return early. While at it, modernize the style of the affected test cases. Signed-off-by: Johannes Sixt Signed-off-by: Junio C Hamano --- t/t9300-fast-import.sh | 88 +++++++++++++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 34 deletions(-) diff --git a/t/t9300-fast-import.sh b/t/t9300-fast-import.sh index 0f5b5e5964..8d7be67dc5 100755 --- a/t/t9300-fast-import.sh +++ b/t/t9300-fast-import.sh @@ -24,6 +24,13 @@ head_c () { ' - "$1" } +verify_packs () { + for p in .git/objects/pack/*.pack + do + git verify-pack "$@" "$p" || return + done +} + file2_data='file2 second line of EOF' @@ -105,9 +112,10 @@ test_expect_success \ 'A: create pack from stdin' \ 'git fast-import --export-marks=marks.out expect < $GIT_COMMITTER_DATE @@ -252,9 +260,11 @@ test_expect_success \ 'A: verify marks import does not crash' \ 'git fast-import --import-marks=marks.out expect <expect <expect < 1170778938 -0500 @@ -669,9 +683,10 @@ test_expect_success \ fi fi ' -test_expect_success \ - 'F: verify pack' \ - 'for p in .git/objects/pack/*.pack;do git verify-pack $p||exit;done' + +test_expect_success 'F: verify pack' ' + verify_packs +' cat >expect <expect <verify && - for p in R/.git/objects/pack/*.pack; - do - git verify-pack -v $p >>verify || exit; - done' + +test_expect_success 'R: verify created pack' ' + ( + cd R && + verify_packs -v > ../verify + ) +' + test_expect_success \ 'R: verify written objects' \ 'git --git-dir=R/.git cat-file blob big-file:big1 >actual && -- 2.11.4.GIT