Re: [PATCH 1/4] refs/reftable: don't write new table on dry-run expire
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Nov 19, 2026, 11:59 UTC
- Message-ID
- <av7ksRi3bQtx3pGf@pks.im>
- In-Reply-To
- <xmqq1p8i84ma.fsf@gitster.g>
On Wed, Nov 18, 2026 at 08:51:41AM -0800, Junio C Hamano wrote:
Show 16 quoted lines
> Patrick Steinhardt <ps@pks.im> writes: > > > The `git reflog expire` subcommand supports a dry-run flag. When set, we > > print what would be pruned without actually pruning anything on disk. > > > > But even though the expectation is that the on-disk state won't change, > > the reftable backend still ends up writing a new reftable to disk that > > contains the changes. This is of course rather pointless, as we would > > have already printed the entries that we're about to prune at that point > > in time. > > I hope I am right in assuming that the current code already has > provisions to discard (or "not to use") this data written to the > disk. If so, that means --dry-run is working correctly, and this > change is a performance-only improvement. Is that the untold piece > of information here?
Yes. We write everything to disk, but instead of committing we then call `reftable_addition_destroy()`, which calls `reftable_addition_close()`, and that function in turn unlinks the table from disk again.
I'll adapt the commit message to make that explicit.
Patrick