Re: [PATCH v4 3/8] maintenance: create auto condition for loose-objects
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Sep 25, 2020, 18:00 UTC
- Message-ID
- <xmqqh7rllos3.fsf@gitster.c.googlers.com>
- In-Reply-To
- <931fff4883a3da26a296af69a9c5ccc3a5037d71.1601037218.git.gitgitgadget@gmail.com>
"Derrick Stolee via GitGitGadget" <gitgitgadget@gmail.com> writes:
Show 20 quoted lines
> diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh > index b3fc7c8670..27565c55a2 100755 > --- a/t/t7900-maintenance.sh > +++ b/t/t7900-maintenance.sh > @@ -127,4 +127,26 @@ test_expect_success 'loose-objects task' ' > test_cmp packs-between packs-after > ' > > +test_expect_success 'maintenance.loose-objects.auto' ' > + git repack -adk && > + GIT_TRACE2_EVENT="$(pwd)/trace-lo1.txt" \ > + 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 && > + 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 &&
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'.
Show 9 quoted lines
> + GIT_TRACE2_EVENT="$(pwd)/trace-loB" \ > + git -c maintenance.loose-objects.auto=2 \ > + maintenance run --auto --task=loose-objects 2>/dev/null && > + test_subcommand git prune-packed --quiet <trace-loB && > + GIT_TRACE2_EVENT="$(pwd)/trace-loC" \ > + git -c maintenance.loose-objects.auto=2 \ > + maintenance run --auto --task=loose-objects 2>/dev/null && > + test_subcommand git prune-packed --quiet <trace-loC > +'