Sorry I'm late to the thread. Thanks for reporting this issue, Johannes. On 7/1/2019 7:33 AM, SZEDER Gábor wrote: > On Mon, Jul 01, 2019 at 05:16:02AM -0400, Jeff King wrote: >> I see Gábor suggested using "wc -c" elsewhere in the thread. That would >> be fine with me, too, though I think the required sed there may be >> getting pretty unreadable, too. :) > > It could be done even without 'sed', though at the expense of running > a coupe more 'wc -c's in a loop:> > diff --git a/t/t5319-multi-pack-index.sh b/t/t5319-multi-pack-index.sh > index 79bfaeafa9..bacec5e2e4 100755 > --- a/t/t5319-multi-pack-index.sh > +++ b/t/t5319-multi-pack-index.sh > @@ -443,7 +443,12 @@ test_expect_success 'repack with minimum size does not alter existing packs' ' > touch -m -t 201901010002 .git/objects/pack/pack-B* && > touch -m -t 201901010003 .git/objects/pack/pack-A* && > ls .git/objects/pack >expect && > - MINSIZE=$(ls -l .git/objects/pack/*pack | awk "{print \$5;}" | sort -n | head -n 1) && > + MINSIZE=$( > + for pack in .git/objects/pack/*pack > + do > + wc -c <"$pack" > + done | sort -n | head -n 1 > + ) && > git multi-pack-index repack --batch-size=$MINSIZE && > ls .git/objects/pack >actual && > test_cmp expect actual > @@ -455,7 +460,12 @@ test_expect_success 'repack creates a new pack' ' > cd dup && > ls .git/objects/pack/*idx >idx-list && > test_line_count = 5 idx-list && > - THIRD_SMALLEST_SIZE=$(ls -l .git/objects/pack/*pack | awk "{print \$5;}" | sort -n | head -n 3 | tail -n 1) && > + THIRD_SMALLEST_SIZE=$( > + for pack in .git/objects/pack/*pack > + do > + wc -c <"$pack" > + done | sort -n | head -n 3 | tail -n 1 > + ) && > BATCH_SIZE=$(($THIRD_SMALLEST_SIZE + 1)) && > git multi-pack-index repack --batch-size=$BATCH_SIZE && > ls .git/objects/pack/*idx >idx-list && > > Is it really better? Dunno, but at least there is no subtlety with > the leading padding spaces. Your change is certainly more straight-forward, and avoids all issues around Perl compatibility. It does have the issue of more 'wc' processes, which is a downside. The count here is not too bad, but if we need to duplicate this pattern elsewhere we may be better off creating a stat(1) replacement in test-lib.sh. Thanks, -Stolee