Skip to content

Commit 3f75a6e

Browse files
rscharfegitster
authored andcommitted
t5317: stop losing return codes of git ls-files
fb2d0db (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 <[email protected]> Signed-off-by: René Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 319605f commit 3f75a6e

File tree

1 file changed

+28
-24
lines changed

1 file changed

+28
-24
lines changed

t/t5317-pack-objects-filter-objects.sh

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ parse_verify_pack_blob_oid () {
2424
}
2525

2626
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 |
2930
sort >expected &&
3031
3132
git -C r1 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -123,8 +124,8 @@ test_expect_success 'setup r2' '
123124
'
124125

125126
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 |
128129
sort >expected &&
129130
130131
git -C r2 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -161,8 +162,8 @@ test_expect_success 'verify blob:limit=1000' '
161162
'
162163

163164
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 |
166167
sort >expected &&
167168
168169
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' '
179180
'
180181

181182
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 |
184185
sort >expected &&
185186
186187
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' '
197198
'
198199

199200
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 |
202203
sort >expected &&
203204
204205
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' '
215216
'
216217

217218
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 |
220221
sort >expected &&
221222
222223
echo HEAD >objects &&
@@ -233,8 +234,8 @@ test_expect_success 'verify explicitly specifying oversized blob in input' '
233234
'
234235

235236
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 |
238239
sort >expected &&
239240
240241
git -C r2 pack-objects --revs --stdout --filter=blob:limit=1m >filter.pack <<-EOF &&
@@ -289,8 +290,9 @@ test_expect_success 'setup r3' '
289290
'
290291

291292
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 |
294296
sort >expected &&
295297
296298
git -C r3 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -341,8 +343,9 @@ test_expect_success 'setup r4' '
341343
'
342344

343345
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 |
346349
sort >expected &&
347350
348351
git -C r4 pack-objects --revs --stdout >all.pack <<-EOF &&
@@ -359,8 +362,8 @@ test_expect_success 'verify blob count in normal packfile' '
359362
'
360363

361364
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 |
364367
sort >expected &&
365368
366369
git -C r4 ls-files -s pattern >staged &&
@@ -379,8 +382,8 @@ test_expect_success 'verify sparse:oid=OID' '
379382
'
380383

381384
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 |
384387
sort >expected &&
385388
386389
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' '
400403
# This models previously omitted objects that we did not receive.
401404

402405
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 |
405409
sort >expected &&
406410
407411
for id in `cat expected | sed "s|..|&/|"`

0 commit comments

Comments
 (0)