Re: [PATCH v4 3/8] maintenance: create auto condition for loose-objects
- From
Derrick Stolee <stolee@gmail.com>
- Date
- Sep 25, 2020, 18:43 UTC
- Message-ID
- <d9b60edf-a06a-85ec-6676-a2e6b1a9a506@gmail.com>
- In-Reply-To
- <xmqqh7rllos3.fsf@gitster.c.googlers.com>
On 9/25/2020 2:00 PM, Junio C Hamano wrote:
Show 11 quoted lines
> "Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes: >> + printf data-B | git hash-object -t blob --stdin -w && > > Is it essential for the purpose of the test somehow that the data > used for the test are all incomplete files that lack the end-of-line > at the end of the file? Use of 'printf' sends such a signal to > confuse readers. > > Use of test_write_lines to write a single line may feel overkill, > but it may be less cryptic, as newer parts of testsuite are > encouraged to use it over 'echo' and raw 'printf'.
I suppose it could be more standard. It's not particularly important what the data is here, so lacking a newline seems innocuous enough to me. I'm happy to agree with standards elsewhere to avoid being a bad example.
A simple s/printf/test_write_lines/ appears to do the trick:
diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index f259485990..a1bd0029c6 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -147,12 +147,12 @@ test_expect_success 'maintenance.loose-objects.auto' ' git -c maintenance.loose-objects.auto=1 maintenance \ run --auto --task=loose-objects 2>/dev/null && test_subcommand ! git prune-packed --quiet <trace-lo1.txt && - printf data-A | git hash-object -t blob --stdin -w && + test_write_lines data-A | git hash-object -t blob --stdin -w && GIT_TRACE2_EVENT="$(pwd)/trace-loA" \ git -c maintenance.loose-objects.auto=2 \ maintenance run --auto --task=loose-objects 2>/dev/null && test_subcommand ! git prune-packed --quiet <trace-loA && - printf data-B | git hash-object -t blob --stdin -w && + test_write_lines data-B | git hash-object -t blob --stdin -w && GIT_TRACE2_EVENT="$(pwd)/trace-loB" \ git -c maintenance.loose-objects.auto=2 \ maintenance run --auto --task=loose-objects 2>/dev/null && Thanks, -Stolee