t0024: avoid losing exit status to pipes

Replace pipe with redirection operator '>' to store the output to a temporary file after 'git archive' command since the pipe will swallow the command's exit code and a crash won't necessarily be noticed. Also fix an unwanted space after redirection '>' to match the style described in CodingGuidelines. Signed-off-by: Ghanshyam Thakkar <shyamthakkar001@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ghanshyam Thakkar committed Jan 19, 2024 at 09:03 UTC d262bfa3021a6ae6f2de37c433345fb44dea2bca
1 file changed +3 -3
t/t0024-crlf-archive.sh
+3 -3
@@ -9,7 +9,7 @@ test_expect_success setup '
9
10 git config core.autocrlf true &&
11
12 - printf "CRLF line ending\r\nAnd another\r\n" > sample &&
12 + printf "CRLF line ending\r\nAnd another\r\n" >sample &&
13 git add sample &&
14
15 test_tick &&
@@ -19,8 +19,8 @@ test_expect_success setup '
19
20 test_expect_success 'tar archive' '
21
22 - git archive --format=tar HEAD |
23 - ( mkdir untarred && cd untarred && "$TAR" -xf - ) &&
22 + git archive --format=tar HEAD >test.tar &&
23 + ( mkdir untarred && cd untarred && "$TAR" -xf ../test.tar ) &&
24
25 test_cmp sample untarred/sample
26