From: Eric Sunshine Date: Mon, 22 Aug 2022 18:26:41 +0000 (+0000) Subject: t1092: fix buggy sparse "blame" test X-Git-Tag: v2.38.0-rc0~46^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=625ff5c3201186cedb856678907a3f4bd88406a6;p=thirdparty%2Fgit.git t1092: fix buggy sparse "blame" test This test wants to verify that `git blame` errors out when asked to blame a file _not_ in the sparse checkout. However, the very first file it asks to blame _is_ present in the checkout, thus `test_must_fail git blame $file` gives an unexpected result (the "blame" succeeds). This problem went unnoticed because the test invokes `test_must_fail git blame $file` in loop but forgets to break out of the loop early upon failure, thus the failure gets swallowed. Fix the test by having it not ask to blame a file present in the sparse checkout, and instead only blame files not present, as intended. While at it, also add the missing `|| return 1` which allowed this bug to go unnoticed. Signed-off-by: Eric Sunshine Signed-off-by: Junio C Hamano --- diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh index a6a14c8a21..e13368861c 100755 --- a/t/t1092-sparse-checkout-compatibility.sh +++ b/t/t1092-sparse-checkout-compatibility.sh @@ -567,7 +567,7 @@ test_expect_success 'blame with pathspec outside sparse definition' ' init_repos && test_sparse_match git sparse-checkout set && - for file in a \ + for file in \ deep/a \ deep/deeper1/a \ deep/deeper1/deepest/a @@ -579,7 +579,7 @@ test_expect_success 'blame with pathspec outside sparse definition' ' # We compare sparse-checkout-err and sparse-index-err in # `test_sparse_match`. Given we know they are the same, we # only check the content of sparse-index-err here. - test_cmp expect sparse-index-err + test_cmp expect sparse-index-err || return 1 done '