Re: [PATCH GSoC v3 1/8] t5701: use test_file_size() to get the size of a file
- From
Pablo Sabater <pabloosabaterr@gmail.com>
- Date
- Aug 3, 2026, 21:12 UTC
- Message-ID
- <DKFM9ZZWDV6O.3GFN589ORNUZ0@gmail.com>
- In-Reply-To
- <xmqqbjbjyv9s.fsf@gitster.g>
On Mon Aug 3, 2026 at 7:21 PM CEST, Junio C Hamano wrote:
Show 16 quoted lines
> Pablo Sabater <pabloosabaterr@gmail.com> writes: > >> The 'basics of object-info' test runs 'wc -c | xargs' twice to get the >> size of two.t. The pipe to xargs is only there to strip the blanks >> that some platforms pad the output of wc with. >> >> Use the test_file_size() helper, which outputs the size directly, and >> store the result in a variable. Because 'git rev-parse two:two.t' is >> also run twice, store its output in a variable as well. > > It also has the benefit of retaining the exit status from commands > run inside a $( ... ) construct placed within a HERE-document. > Earlier, if your "git rev-parse" failed, you would not have noticed > it directly (though you would probably have seen the "expect" file > containing unexpected content). Now your assignment fails when you > compute two_oid, if your "git rev-parse" segfaults.
I will add that next reroll.
Thanks, Pablo