t5317: stop losing return codes of git ls-files

fb2d0db502 (test-lib-functions: add parsing helpers for ls-files and ls-tree, 2022-04-04) not only started to use helper functions, it also started to pipe the output of git ls-files into them directly, without using a temporary file. No explanation was given. This causes the return code of that git command to be ignored. Revert that part of the change, use temporary files and check the return code of git ls-files again. Suggested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>

René Scharfe committed Nov 29, 2022 at 13:21 UTC 3f75a6e5b44d179dbfa99622a8a19d4bd4e04d8f
1 file changed +28 -24
t/t5317-pack-objects-filter-objects.sh
+28 -24
@@ -24,8 +24,9 @@ parse_verify_pack_blob_oid () {
24 }
25
26 test_expect_success 'verify blob count in normal packfile' '
27 - git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 |
28 - test_parse_ls_files_stage_oids |
27 + git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \
28 + >ls_files_result &&
29 + test_parse_ls_files_stage_oids <ls_files_result |
30 sort >expected &&
31
32 git -C r1 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -123,8 +124,8 @@ test_expect_success 'setup r2' '
124 '
125
126 test_expect_success 'verify blob count in normal packfile' '
126 - git -C r2 ls-files -s large.1000 large.10000 |
127 - test_parse_ls_files_stage_oids |
127 + git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
128 + test_parse_ls_files_stage_oids <ls_files_result |
129 sort >expected &&
130
131 git -C r2 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -161,8 +162,8 @@ test_expect_success 'verify blob:limit=1000' '
162 '
163
164 test_expect_success 'verify blob:limit=1001' '
164 - git -C r2 ls-files -s large.1000 |
165 - test_parse_ls_files_stage_oids |
165 + git -C r2 ls-files -s large.1000 >ls_files_result &&
166 + test_parse_ls_files_stage_oids <ls_files_result |
167 sort >expected &&
168
169 git -C r2 pack-objects --revs --stdout --filter=blob:limit=1001 >filter.pack <<-EOF &&
@@ -179,8 +180,8 @@ test_expect_success 'verify blob:limit=1001' '
180 '
181
182 test_expect_success 'verify blob:limit=10001' '
182 - git -C r2 ls-files -s large.1000 large.10000 |
183 - test_parse_ls_files_stage_oids |
183 + git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
184 + test_parse_ls_files_stage_oids <ls_files_result |
185 sort >expected &&
186
187 git -C r2 pack-objects --revs --stdout --filter=blob:limit=10001 >filter.pack <<-EOF &&
@@ -197,8 +198,8 @@ test_expect_success 'verify blob:limit=10001' '
198 '
199
200 test_expect_success 'verify blob:limit=1k' '
200 - git -C r2 ls-files -s large.1000 |
201 - test_parse_ls_files_stage_oids |
201 + git -C r2 ls-files -s large.1000 >ls_files_result &&
202 + test_parse_ls_files_stage_oids <ls_files_result |
203 sort >expected &&
204
205 git -C r2 pack-objects --revs --stdout --filter=blob:limit=1k >filter.pack <<-EOF &&
@@ -215,8 +216,8 @@ test_expect_success 'verify blob:limit=1k' '
216 '
217
218 test_expect_success 'verify explicitly specifying oversized blob in input' '
218 - git -C r2 ls-files -s large.1000 large.10000 |
219 - test_parse_ls_files_stage_oids |
219 + git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
220 + test_parse_ls_files_stage_oids <ls_files_result |
221 sort >expected &&
222
223 echo HEAD >objects &&
@@ -233,8 +234,8 @@ test_expect_success 'verify explicitly specifying oversized blob in input' '
234 '
235
236 test_expect_success 'verify blob:limit=1m' '
236 - git -C r2 ls-files -s large.1000 large.10000 |
237 - test_parse_ls_files_stage_oids |
237 + git -C r2 ls-files -s large.1000 large.10000 >ls_files_result &&
238 + test_parse_ls_files_stage_oids <ls_files_result |
239 sort >expected &&
240
241 git -C r2 pack-objects --revs --stdout --filter=blob:limit=1m >filter.pack <<-EOF &&
@@ -289,8 +290,9 @@ test_expect_success 'setup r3' '
290 '
291
292 test_expect_success 'verify blob count in normal packfile' '
292 - git -C r3 ls-files -s sparse1 sparse2 dir1/sparse1 dir1/sparse2 |
293 - test_parse_ls_files_stage_oids |
293 + git -C r3 ls-files -s sparse1 sparse2 dir1/sparse1 dir1/sparse2 \
294 + >ls_files_result &&
295 + test_parse_ls_files_stage_oids <ls_files_result |
296 sort >expected &&
297
298 git -C r3 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -341,8 +343,9 @@ test_expect_success 'setup r4' '
343 '
344
345 test_expect_success 'verify blob count in normal packfile' '
344 - git -C r4 ls-files -s pattern sparse1 sparse2 dir1/sparse1 dir1/sparse2 |
345 - test_parse_ls_files_stage_oids |
346 + git -C r4 ls-files -s pattern sparse1 sparse2 dir1/sparse1 dir1/sparse2 \
347 + >ls_files_result &&
348 + test_parse_ls_files_stage_oids <ls_files_result |
349 sort >expected &&
350
351 git -C r4 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -359,8 +362,8 @@ test_expect_success 'verify blob count in normal packfile' '
362 '
363
364 test_expect_success 'verify sparse:oid=OID' '
362 - git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 |
363 - test_parse_ls_files_stage_oids |
365 + git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 >ls_files_result &&
366 + test_parse_ls_files_stage_oids <ls_files_result |
367 sort >expected &&
368
369 git -C r4 ls-files -s pattern >staged &&
@@ -379,8 +382,8 @@ test_expect_success 'verify sparse:oid=OID' '
382 '
383
384 test_expect_success 'verify sparse:oid=oid-ish' '
382 - git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 |
383 - test_parse_ls_files_stage_oids |
385 + git -C r4 ls-files -s dir1/sparse1 dir1/sparse2 >ls_files_result &&
386 + test_parse_ls_files_stage_oids <ls_files_result |
387 sort >expected &&
388
389 git -C r4 pack-objects --revs --stdout --filter=sparse:oid=main:pattern >filter.pack <<-EOF &&
@@ -400,8 +403,9 @@ test_expect_success 'verify sparse:oid=oid-ish' '
403 # This models previously omitted objects that we did not receive.
404
405 test_expect_success 'setup r1 - delete loose blobs' '
403 - git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 |
404 - test_parse_ls_files_stage_oids |
406 + git -C r1 ls-files -s file.1 file.2 file.3 file.4 file.5 \
407 + >ls_files_result &&
408 + test_parse_ls_files_stage_oids <ls_files_result |
409 sort >expected &&
410
411 for id in `cat expected | sed "s|..|&/|"`