From: Shubham Mishra Date: Wed, 23 Feb 2022 11:53:47 +0000 (+0530) Subject: t0003: avoid pipes with Git on LHS X-Git-Tag: v2.36.0-rc0~56^2~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ae5d569bb22ea4e889c9a2da757ed0c253ec1fc1;p=thirdparty%2Fgit.git 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 Signed-off-by: Junio C Hamano --- diff --git a/t/t0003-attributes.sh b/t/t0003-attributes.sh index b9ed612af1..143f100517 100755 --- a/t/t0003-attributes.sh +++ b/t/t0003-attributes.sh @@ -205,15 +205,18 @@ test_expect_success 'attribute test: read paths from stdin' ' test_expect_success 'attribute test: --all option' ' grep -v unspecified specified-all && sed -e "s/:.*//" stdin-all && - git check-attr --stdin --all actual && + git check-attr --stdin --all tmp && + sort tmp >actual && test_cmp specified-all actual ' test_expect_success 'attribute test: --cached option' ' - git check-attr --cached --stdin --all actual && + git check-attr --cached --stdin --all tmp && + sort tmp >actual && test_must_be_empty actual && git add .gitattributes a/.gitattributes a/b/.gitattributes && - git check-attr --cached --stdin --all actual && + git check-attr --cached --stdin --all tmp && + sort tmp >actual && test_cmp specified-all actual '