Re: [PATCH 05/10] t/t9300-fast-import.sh: prepare for `gc --cruft` by default
- From
Taylor Blau <me@ttaylorr.com>
- Date
- Apr 18, 2023, 19:44 UTC
- Message-ID
- <ZD7zKl3iDQc/TbWJ@nand.local>
- In-Reply-To
- <20230418104331.GE508219@coredump.intra.peff.net>
On Tue, Apr 18, 2023 at 06:43:31AM -0400, Jeff King wrote:
Show 17 quoted lines
> On Mon, Apr 17, 2023 at 04:54:27PM -0400, Taylor Blau wrote: > > > In a similar fashion as the previous commit, adjust the fast-import > > tests to prepare for "git gc" generating a cruft pack by default. > > > > This adjustment is slightly different, however. Instead of relying on us > > writing out the objects loose, and then calling `git prune` to remove > > them, t9300 needs to be prepared to drop objects that would be moved > > into cruft packs. > > > > To do this, we can combine the `git gc` invocation with `git prune` into > > one `git gc --prune`, which handles pruning both loose objects, and > > objects that would otherwise be written to a cruft pack. > > Good. This is more efficient anyway. It probably does not matter for our > tiny test repository, but it is always good for our tests to model the > best option when possible. :)
I spent more time than I'd willingly admit second-guessing myself wondering if there was something I'm missing why we'd want to call `git gc` and `git prune` separately.
As best as I can tell, this pattern started all the way back in 03db4525d3 (Support gitlinks in fast-import., 2008-07-19), which happened after deprecating `git gc --prune` in 9e7d501990 (builtin-gc.c: deprecate --prune, it now really has no effect, 2008-05-09).
After `--prune` was un-deprecated in 58e9d9d472 (gc: make --prune useful again by accepting an optional parameter, 2009-02-14), we got a handful of new uses in this script via 4cedb78cb5 (fast-import: add input format tests, 2011-08-11), which could have been `git gc --prune`, but weren't (likely taking after 03db4525d3).
I don't know if any of that detail is interesting enough to rise to the level of needing to be in the patch itself, those were just my notes I took while wandering through this part of the suite.
> > t/t9300-fast-import.sh | 13 ++++--------- > > 1 file changed, 4 insertions(+), 9 deletions(-) > > The patch itself looks good to me.
Thanks!
-Taylor