Re: [PATCH v2 5/6] p5313: add size comparison test
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 23, 2024, 16:14 UTC
- Message-ID
- <xmqq4j665ov2.fsf@gitster.g>
- In-Reply-To
- <24d266e4-4279-42fa-871e-c843ba6d4f5e@gmail.com>
Derrick Stolee <stolee@gmail.com> writes:
Show 9 quoted lines
> On 9/19/24 5:58 PM, Junio C Hamano wrote: >> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> 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.
Show 5 quoted lines
> 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"
;-)
Show 11 quoted lines
> 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