Skip to content

Commit a0578e0

Browse files
larsxschneidergitster
authored andcommitted
t: do not hide Git's exit code in tests using 'nul_to_q'
Git should not be on the left-hand side of a pipe, because it hides the exit code, and we want to make sure git does not fail. Fix all invocations of 'nul_to_q' (defined in /t/test-lib-functions.sh) using this pattern. There is one more occurrence of the pattern in t9010-svn-fe.sh which is too evolved to change it easily. All remaining test code that does not adhere to the pattern can be found with the following command: git grep -E 'git.*[^|]\|($|[^|])' Helped-by: Jeff King <[email protected]> Signed-off-by: Lars Schneider <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7548842 commit a0578e0

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

t/t1300-repo-config.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,13 +957,15 @@ Qsection.sub=section.val4
957957
Qsection.sub=section.val5Q
958958
EOF
959959
test_expect_success '--null --list' '
960-
git config --null --list | nul_to_q >result &&
960+
git config --null --list >result.raw &&
961+
nul_to_q <result.raw >result &&
961962
echo >>result &&
962963
test_cmp expect result
963964
'
964965

965966
test_expect_success '--null --get-regexp' '
966-
git config --null --get-regexp "val[0-9]" | nul_to_q >result &&
967+
git config --null --get-regexp "val[0-9]" >result.raw &&
968+
nul_to_q <result.raw >result &&
967969
echo >>result &&
968970
test_cmp expect result
969971
'

t/t7008-grep-binary.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,8 @@ test_expect_success 'grep respects not-binary diff attribute' '
141141
test_cmp expect actual &&
142142
echo "b diff" >.gitattributes &&
143143
echo "b:binQary" >expect &&
144-
git grep bin b | nul_to_q >actual &&
144+
git grep bin b >actual.raw &&
145+
nul_to_q <actual.raw >actual &&
145146
test_cmp expect actual
146147
'
147148

0 commit comments

Comments
 (0)