Message ID | 20220223115347.3083-3-shivam828787@gmail.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | avoid pipes with Git on LHS | expand |
On Wed, Feb 23, 2022 at 05:23:47PM +0530, Shubham Mishra wrote: > t/t0003-attributes.sh | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) This patch looks great to me, thanks! Reviewed-by: Taylor Blau <me@ttaylorr.com> Thanks, Taylor
Thanks for reviewing it :) On Wed, Feb 23, 2022 at 11:24 PM Taylor Blau <me@ttaylorr.com> wrote: > > On Wed, Feb 23, 2022 at 05:23:47PM +0530, Shubham Mishra wrote: > > t/t0003-attributes.sh | 9 ++++++--- > > 1 file changed, 6 insertions(+), 3 deletions(-) > > This patch looks great to me, thanks! > > Reviewed-by: Taylor Blau <me@ttaylorr.com> > > Thanks, > Taylor
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 <expect-all | sort >specified-all && sed -e "s/:.*//" <expect-all | uniq >stdin-all && - git check-attr --stdin --all <stdin-all | sort >actual && + git check-attr --stdin --all <stdin-all >tmp && + sort tmp >actual && test_cmp specified-all actual ' test_expect_success 'attribute test: --cached option' ' - git check-attr --cached --stdin --all <stdin-all | sort >actual && + git check-attr --cached --stdin --all <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 <stdin-all | sort >actual && + git check-attr --cached --stdin --all <stdin-all >tmp && + sort tmp >actual && test_cmp specified-all actual '
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 <shivam828787@gmail.com> --- t/t0003-attributes.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)