Re: [PATCH 1/4] refs: pass refname when invoking reflog entry callback
- From
Patrick Steinhardt <ps@pks.im>
- Date
- Jul 31, 2025, 08:28 UTC
- Message-ID
- <aIspLhS-hVIHQ473@pks.im>
- In-Reply-To
- <CAOLa=ZR10eOikwFyDwMDSyX2qQM-knCKhCKB4YtLD=Pdoz=vTA@mail.gmail.com>
On Tue, Jul 29, 2025 at 01:30:49PM -0700, Karthik Nayak wrote:
Show 25 quoted lines
> Patrick Steinhardt <ps@pks.im> writes: > > > With `refs_for_each_reflog_ent()` callers can iterate through all the > > reflog entries for a given reference. The callback that is being invoked > > for each such entry does not receive the name of the reference that we > > are currently iterating through. This isn't really a limiting factor, as > > callers can simply pass the name via the callback data. > > > > But this layout sometimes does make for a bit of an awkward calling > > pattern. One example: when iterating through all reflogs, and for each > > reflog we iterate through all refnames, we have to do some extra book > > keeping to track which reference name we are currently yielding reflog > > entries for. > > > > Change the signature of the callback function so that the reference name > > of the reflog gets passed through to it. Adapt callers accordingly and > > start using the new parameter in trivial cases. The next commit will > > refactor the reference migration logic to make use of this parameter so > > that we can simplify its logic a bit. > > > > I remember hitting this issue with the migration code in 'refs.c', so I > think this is a good improvement. The changes themselves look good. > > Nit: Changes suggested by clang-format in case you re-roll:
Okay, I've rolled in both suggestions. I'll not send a new version only to address these reformats though.
Patrick