Skip to content

Commit ae5d569

Browse files
Shubham8287gitster
authored andcommitted
t0003: avoid pipes with Git on LHS
Pipes ignore error codes of LHS command and thus we should not use them with Git in tests. As an alternative, use a 'tmp' file to write the Git output so we can test the exit code. Signed-off-by: Shubham Mishra <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 4c53a8c commit ae5d569

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

t/t0003-attributes.sh

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,15 +205,18 @@ test_expect_success 'attribute test: read paths from stdin' '
205205
test_expect_success 'attribute test: --all option' '
206206
grep -v unspecified <expect-all | sort >specified-all &&
207207
sed -e "s/:.*//" <expect-all | uniq >stdin-all &&
208-
git check-attr --stdin --all <stdin-all | sort >actual &&
208+
git check-attr --stdin --all <stdin-all >tmp &&
209+
sort tmp >actual &&
209210
test_cmp specified-all actual
210211
'
211212

212213
test_expect_success 'attribute test: --cached option' '
213-
git check-attr --cached --stdin --all <stdin-all | sort >actual &&
214+
git check-attr --cached --stdin --all <stdin-all >tmp &&
215+
sort tmp >actual &&
214216
test_must_be_empty actual &&
215217
git add .gitattributes a/.gitattributes a/b/.gitattributes &&
216-
git check-attr --cached --stdin --all <stdin-all | sort >actual &&
218+
git check-attr --cached --stdin --all <stdin-all >tmp &&
219+
sort tmp >actual &&
217220
test_cmp specified-all actual
218221
'
219222

0 commit comments

Comments
 (0)