public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Karthik Nayak <karthik.188@gmail•com>
To: Patrick Steinhardt <ps@pks•im>
Cc: git@vger•kernel.org
Subject: Re: [PATCH 11/17] refs: replace `refs_for_each_ref_in()`
Date: Mon, 23 Feb 2026 05:35:19 -0800	[thread overview]
Message-ID: <CAOLa=ZTduJUmcBeViAg43DL6LcpaSLf6eNHTpriaZ9swo7PoAA@mail.gmail.com> (raw)
In-Reply-To: <aZwwchZjnSMTiN0m@pks.im>

[-- Attachment #1: Type: text/plain, Size: 1261 bytes --]

Patrick Steinhardt <ps@pks•im> writes:

> On Mon, Feb 23, 2026 at 04:11:52AM -0500, Karthik Nayak wrote:
>> Patrick Steinhardt <ps@pks•im> writes:
>> > diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
>> > index 9032cc6327..02703f2fb8 100644
>> > --- a/builtin/rev-parse.c
>> > +++ b/builtin/rev-parse.c
>> > @@ -613,13 +613,18 @@ static int opt_with_value(const char *arg, const char *opt, const char **value)
>> >
>> >  static void handle_ref_opt(const char *pattern, const char *prefix)
>> >  {
>> > -	if (pattern)
>> > +	if (pattern) {
>> >  		refs_for_each_glob_ref_in(get_main_ref_store(the_repository),
>> >  					  show_reference, pattern, prefix,
>> >  					  NULL);
>> > -	else
>> > -		refs_for_each_ref_in(get_main_ref_store(the_repository),
>> > -				     prefix, show_reference, NULL);
>> > +	} else {
>> > +		struct refs_for_each_ref_options opts = {
>> > +			.prefix = prefix,
>> > +			.trim_prefix = strlen(prefix),
>>
>> Tangent: I wonder if it makes sense to make `trim_prefix` a bool and
>> then internally trim strlen(prefix). Is there a usecase where
>> `.trim_prefix != strlen(prefix)`?
>
> I don't think there is right now, and I cannot think about any myself.
> How about we leave this as a #leftoverbit though?
>
> Patrick

Sure!

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 690 bytes --]

  reply	other threads:[~2026-02-23 13:35 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-20  8:24 [PATCH 00/17] refs: unify `refs_for_each_*()` functions Patrick Steinhardt
2026-02-20  8:24 ` [PATCH 01/17] refs: move `refs_head_ref_namespaced()` Patrick Steinhardt
2026-02-23  8:05   ` Karthik Nayak
2026-02-23 10:46     ` Patrick Steinhardt
2026-02-20  8:24 ` [PATCH 02/17] refs: move `do_for_each_ref_flags` further up Patrick Steinhardt
2026-02-20  8:24 ` [PATCH 03/17] refs: rename `do_for_each_ref_flags` Patrick Steinhardt
2026-02-20  8:24 ` [PATCH 04/17] refs: rename `each_ref_fn` Patrick Steinhardt
2026-02-23  8:07   ` Karthik Nayak
2026-02-20  8:24 ` [PATCH 05/17] refs: remove unused `refs_for_each_include_root_ref()` Patrick Steinhardt
2026-02-20 10:29   ` Oswald Buddenhagen
2026-02-20 12:05     ` Patrick Steinhardt
2026-02-20  8:24 ` [PATCH 06/17] refs: introduce `refs_for_each_ref_ext` Patrick Steinhardt
2026-02-23  8:14   ` Karthik Nayak
2026-02-20  8:24 ` [PATCH 07/17] refs: speed up `refs_for_each_glob_ref_in()` Patrick Steinhardt
2026-02-23  8:27   ` Karthik Nayak
2026-02-23 10:48     ` Patrick Steinhardt
2026-02-20  8:24 ` [PATCH 08/17] refs: generalize `refs_for_each_namespaced_ref()` Patrick Steinhardt
2026-02-23  9:02   ` Karthik Nayak
2026-02-23 10:48     ` Patrick Steinhardt
2026-02-20  8:24 ` [PATCH 09/17] refs: generalize `refs_for_each_fullref_in_prefixes()` Patrick Steinhardt
2026-02-23  9:06   ` Karthik Nayak
2026-02-20  8:24 ` [PATCH 10/17] refs: improve verification for-each-ref options Patrick Steinhardt
2026-02-23  9:09   ` Karthik Nayak
2026-02-20  8:24 ` [PATCH 11/17] refs: replace `refs_for_each_ref_in()` Patrick Steinhardt
2026-02-23  9:11   ` Karthik Nayak
2026-02-23 10:48     ` Patrick Steinhardt
2026-02-23 13:35       ` Karthik Nayak [this message]
2026-02-20  8:24 ` [PATCH 12/17] refs: replace `refs_for_each_rawref()` Patrick Steinhardt
2026-02-20  8:24 ` [PATCH 13/17] refs: replace `refs_for_each_rawref_in()` Patrick Steinhardt
2026-02-20  8:24 ` [PATCH 14/17] refs: replace `refs_for_each_glob_ref_in()` Patrick Steinhardt
2026-02-20  8:24 ` [PATCH 15/17] refs: replace `refs_for_each_glob_ref()` Patrick Steinhardt
2026-02-20  8:24 ` [PATCH 16/17] refs: replace `refs_for_each_namespaced_ref()` Patrick Steinhardt
2026-02-20  8:24 ` [PATCH 17/17] refs: replace `refs_for_each_fullref_in()` Patrick Steinhardt
2026-02-23  9:14 ` [PATCH 00/17] refs: unify `refs_for_each_*()` functions Karthik Nayak
2026-02-23 11:59 ` [PATCH v2 " Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 01/17] refs: remove unused `refs_for_each_include_root_ref()` Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 02/17] refs: move `refs_head_ref_namespaced()` Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 03/17] refs: move `do_for_each_ref_flags` further up Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 04/17] refs: rename `do_for_each_ref_flags` Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 05/17] refs: rename `each_ref_fn` Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 06/17] refs: introduce `refs_for_each_ref_ext` Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 07/17] refs: speed up `refs_for_each_glob_ref_in()` Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 08/17] refs: generalize `refs_for_each_namespaced_ref()` Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 09/17] refs: generalize `refs_for_each_fullref_in_prefixes()` Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 10/17] refs: improve verification for-each-ref options Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 11/17] refs: replace `refs_for_each_ref_in()` Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 12/17] refs: replace `refs_for_each_rawref()` Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 13/17] refs: replace `refs_for_each_rawref_in()` Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 14/17] refs: replace `refs_for_each_glob_ref_in()` Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 15/17] refs: replace `refs_for_each_glob_ref()` Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 16/17] refs: replace `refs_for_each_namespaced_ref()` Patrick Steinhardt
2026-02-23 11:59   ` [PATCH v2 17/17] refs: replace `refs_for_each_fullref_in()` Patrick Steinhardt
2026-02-24 13:14   ` [PATCH v2 00/17] refs: unify `refs_for_each_*()` functions Karthik Nayak

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='CAOLa=ZTduJUmcBeViAg43DL6LcpaSLf6eNHTpriaZ9swo7PoAA@mail.gmail.com' \
    --to=karthik.188@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=ps@pks$(echo .)im \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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