Skip to content

Commit 98d6ff3

Browse files
MissTipogitster
authored andcommitted
t0410: keep git's exit code in test_grep calls
The 'rev-list stops traversal at missing and promised tree' test passes "$(git -C repo rev-parse ...)" directly to test_grep. t/README says not to use command substitution in a way that discards git's exit code: the && chain only sees test_grep's exit code, so a failure in git is not caught there. Assign the rev-parse output to variables first and pass those to test_grep instead. Signed-off-by: Dorine Tipo <dorine.a.tipo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent 38821a2 commit 98d6ff3

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎t/t0410-partial-clone.sh‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,9 +413,13 @@ test_expect_success 'rev-list stops traversal at missing and promised tree' '
413413
git -C repo config core.repositoryformatversion 1 &&
414414
git -C repo config extensions.partialclone "arbitrary string" &&
415415
git -C repo rev-list --exclude-promisor-objects --objects HEAD >out &&
416-
test_grep $(git -C repo rev-parse foo) out &&
416+
417+
FOO=$(git -C repo rev-parse foo) &&
418+
HEAD_OID=$(git -C repo rev-parse HEAD) &&
419+
420+
test_grep "$FOO" out &&
417421
test_grep ! $TREE out &&
418-
test_grep $(git -C repo rev-parse HEAD) out &&
422+
test_grep "$HEAD_OID" out &&
419423
test_grep ! $TREE2 out
420424
'
421425

0 commit comments

Comments
 (0)