git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: Karthik Nayak <karthik.188@gmail.com>
Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>,
	Jeff King <peff@peff.net>, Han Jiang <jhcarl0814@gmail.com>
Subject: Re: [PATCH 1/4] refs: pass refname when invoking reflog entry callback
Date: Thu, 31 Jul 2025 10:28:30 +0200	[thread overview]
Message-ID: <aIspLhS-hVIHQ473@pks.im> (raw)
In-Reply-To: <CAOLa=ZR10eOikwFyDwMDSyX2qQM-knCKhCKB4YtLD=Pdoz=vTA@mail.gmail.com>

On Tue, Jul 29, 2025 at 01:30:49PM -0700, Karthik Nayak wrote:
> 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

  reply	other threads:[~2025-07-31  8:28 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-28 13:08 [PATCH 0/4] builtin/remote: rework how remote refs get renamed Patrick Steinhardt
2025-07-28 13:08 ` [PATCH 1/4] refs: pass refname when invoking reflog entry callback Patrick Steinhardt
2025-07-28 15:59   ` Justin Tobler
2025-07-28 16:07   ` Junio C Hamano
2025-07-29 20:30   ` Karthik Nayak
2025-07-31  8:28     ` Patrick Steinhardt [this message]
2025-07-28 13:08 ` [PATCH 2/4] refs: simplify logic when migrating reflog entries Patrick Steinhardt
2025-07-28 16:08   ` Justin Tobler
2025-07-28 16:21   ` Junio C Hamano
2025-07-28 13:08 ` [PATCH 3/4] builtin/remote: rework how remote refs get renamed Patrick Steinhardt
2025-07-28 17:19   ` Junio C Hamano
2025-07-29  8:43     ` Patrick Steinhardt
2025-07-28 18:47   ` Justin Tobler
2025-07-28 18:57     ` Junio C Hamano
2025-07-29  8:43       ` Patrick Steinhardt
2025-07-29  8:16   ` Jeff King
2025-07-29 12:24     ` Patrick Steinhardt
2025-08-02 10:48       ` Jeff King
2025-07-28 13:08 ` [PATCH 4/4] builtin/remote: only iterate through refs that are to be renamed Patrick Steinhardt
2025-07-28 17:43   ` Junio C Hamano
2025-07-30  7:53   ` Karthik Nayak
2025-07-31  8:28     ` Patrick Steinhardt
2025-07-28 15:43 ` [PATCH 0/4] builtin/remote: rework how remote refs get renamed Junio C Hamano
2025-07-31 14:56 ` [PATCH v2 0/6] " Patrick Steinhardt
2025-07-31 14:56   ` [PATCH v2 1/6] refs: pass refname when invoking reflog entry callback Patrick Steinhardt
2025-07-31 14:56   ` [PATCH v2 2/6] refs: simplify logic when migrating reflog entries Patrick Steinhardt
2025-07-31 14:56   ` [PATCH v2 3/6] builtin/remote: fix sign comparison warnings Patrick Steinhardt
2025-07-31 14:56   ` [PATCH v2 4/6] builtin/remote: determine whether refs need renaming early on Patrick Steinhardt
2025-07-31 14:56   ` [PATCH v2 5/6] builtin/remote: rework how remote refs get renamed Patrick Steinhardt
2025-08-02 10:45     ` Jeff King
2025-08-04  6:54       ` Patrick Steinhardt
2025-07-31 14:56   ` [PATCH v2 6/6] builtin/remote: only iterate through refs that are to be renamed Patrick Steinhardt
2025-07-31 19:15   ` [PATCH v2 0/6] builtin/remote: rework how remote refs get renamed Junio C Hamano
2025-08-01  4:59     ` Patrick Steinhardt
2025-08-01 16:43       ` Junio C Hamano
2025-08-04  6:51         ` Patrick Steinhardt
2025-08-04 18:24           ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aIspLhS-hVIHQ473@pks.im \
    --to=ps@pks.im \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jhcarl0814@gmail.com \
    --cc=karthik.188@gmail.com \
    --cc=peff@peff.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).