Skip to content

Commit 625ff5c

Browse files
sunshinecogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 308cbaa commit 625ff5c

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

t/t1092-sparse-checkout-compatibility.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -567,7 +567,7 @@ test_expect_success 'blame with pathspec outside sparse definition' '
567567
init_repos &&
568568
test_sparse_match git sparse-checkout set &&
569569
570-
for file in a \
570+
for file in \
571571
deep/a \
572572
deep/deeper1/a \
573573
deep/deeper1/deepest/a
@@ -579,7 +579,7 @@ test_expect_success 'blame with pathspec outside sparse definition' '
579579
# We compare sparse-checkout-err and sparse-index-err in
580580
# `test_sparse_match`. Given we know they are the same, we
581581
# only check the content of sparse-index-err here.
582-
test_cmp expect sparse-index-err
582+
test_cmp expect sparse-index-err || return 1
583583
done
584584
'
585585

0 commit comments

Comments
 (0)