From: Junio C Hamano Date: Mon, 23 Sep 2024 16:14:25 GMT Subject: Re: [PATCH v2 5/6] p5313: add size comparison test Message-ID: In-Reply-To: <24d266e4-4279-42fa-871e-c843ba6d4f5e@gmail.com> Derrick Stolee writes: > On 9/19/24 5:58 PM, Junio C Hamano wrote: >> "Derrick Stolee via GitGitGadget" writes: > >>> t/perf/p5313-pack-objects.sh | 71 ++++++++++++++++++++++++++++++++++++ >>> 1 file changed, 71 insertions(+) >>> create mode 100755 t/perf/p5313-pack-objects.sh >> "wc -c" -> "test_file_size" or "test-tool path-utils file-size"? > > Thanks. I was unfamiliar with those options. I was, too ;-). There are a few other test pieces that use "wc -c" to count bytes, but it made me a bit nervous to use it to count bytes in a binary file. > test_size 'repack size' ' > - wc -c <.git/objects/pack/pack-*.pack > + pack=$(ls .git/objects/pack/pack-*.pack) && > + test_file_size "$pack" > ' I am perfectly fine (and actually even prefer) to pay the cost to fork "ls" here, but if you really wanted to avoid it, we could do something like pack=$( set x .git/objects/pack/pack-*.pack && test $# = 2 && echo "$2" || exit 1 ) && test_file_size "$pack" ;-) > test_perf 'repack with --full-name-hash' ' > @@ -65,7 +66,8 @@ test_perf 'repack with --full-name-hash' ' > ' > > test_size 'repack size with --full-name-hash' ' > - wc -c <.git/objects/pack/pack-*.pack > + pack=$(ls .git/objects/pack/pack-*.pack) && > + test_file_size "$pack" > ' > > test_done