Re: [PATCH v3 3/8] maintenance: create auto condition for loose-objects
- From
- Jonathan Tan <jonathantanmy@google.com>
- Date
- Sep 22, 2020, 23:15 UTC
- Message-ID
- <20200922231501.908887-1-jonathantanmy@google.com>
- In-Reply-To
- <d6e382c43effe063fb1137659f616d414ee52682.1598380599.git.gitgitgadget@gmail.com>
Show 7 quoted lines
> +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 && > + for i in 1 2
Any reason why this is run twice?
Show 6 quoted lines
> + do > + printf data-A-$i | git hash-object -t blob --stdin -w && > + GIT_TRACE2_EVENT="$(pwd)/trace-loA-$i" \ > + git -c maintenance.loose-objects.auto=2 \ > + maintenance run --auto --task=loose-objects 2>/dev/null && > + test_subcommand ! git prune-packed --quiet <trace-loA-$i &&
OK - there is only 1 loose object so the loose-objects task doesn't get run.
Show 5 quoted lines
> + printf data-B-$i | git hash-object -t blob --stdin -w && > + GIT_TRACE2_EVENT="$(pwd)/trace-loB-$i" \ > + git -c maintenance.loose-objects.auto=2 \ > + maintenance run --auto --task=loose-objects 2>/dev/null && > + test_subcommand git prune-packed --quiet <trace-loB-$i &&
OK - there are 2 loose objects so the loose-objects task gets run. But we need to remember that the first time it is run, only the packfile gets created - the loose objects aren't deleted. "prune-packed" here is to show that the loose-objects task is run, but it has no effect.
> + GIT_TRACE2_EVENT="$(pwd)/trace-loC-$i" \ > + git -c maintenance.loose-objects.auto=2 \ > + maintenance run --auto --task=loose-objects 2>/dev/null && > + test_subcommand git prune-packed --quiet <trace-loC-$i || return 1
OK - the 2 loose objects still exist, so the loose-objects task gets run. "prune-packed" here shows that the loose-objects task is run.