Re: [PATCH v10 1/5] fetch: add remote.<name>.refmap
- From
Harald Nordgren <haraldnordgren@gmail.com>
- Date
- Oct 25, 2026, 16:47 UTC
- Message-ID
- <CAHwyqnWuj_1x9B4H+Kto2rZn6YeaM+X-vUb-uUb2jr134gcHjA@mail.gmail.com>
- In-Reply-To
- <CALnO6CBAEB8=FfZfde0OWvfLJikVkXQ8itP9wZpGHxfxK+y_LQ@mail.gmail.com>
On Sun, Oct 25, 2026 at 4:14 PM D. Ben Knoble <ben.knoble@gmail.com> wrote:
Show 46 quoted lines
>
> On Sat, Oct 24, 2026 at 1:19 PM Harald Nordgren
> <haraldnordgren@gmail.com> wrote:
> >
> > > remote.h says this procedure does "For the given remote, reads the
> > > refspec's src and sets the other fields." Ok, and glancing at
> > > refspec_find_match the idea is that "refspec" input is a query (with a
> > > src or dst) and we find the matching entry and fill out the input's
> > > fields.
> > >
> > > So… I assume the usual idea would be that refmap is a "superset" of
> > > the fetch refspec, since I might want to map refs that I don't
> > > normally fetch. (Or it might be disjoint, if none of the mappings
> > > apply to my usual fetches.) But that means that remote_find_tracking()
> > > won't be able to find entries for the mapped refs that aren't part of
> > > my "normal" fetches? Are there downstream consequences of that? I'm
> > > not sure, I haven't looked at how else remote_find_tracking is used.
> > >
> > > Could that affect, for example, --delete-merged?
> >
> > Good point, I will change it like this:
> >
> > ```
> > 1: ba7f1354cd ! 16: 4603c84d68 fetch: add remote.<name>.refmap
> > @@ remote.c: void ref_push_report_free(struct ref_push_report *report)
> > int remote_find_tracking(struct remote *remote, struct
> > refspec_item *refspec)
> > {
> > - return refspec_find_match(&remote->fetch, refspec);
> > -+ if (remote->fetch.nr)
> > -+ return refspec_find_match(&remote->fetch, refspec);
> > -+ return refspec_find_match(&remote->refmap, refspec);
> > ++ if (!remote->fetch.nr || refspec_find_match(&remote->fetch, refspec))
> > ++ return refspec_find_match(&remote->refmap, refspec);
> > ++ return 0;
> > }
> >
> > static struct ref *alloc_ref_with_prefix(const char *prefix,
> > size_t prefixlen,
> > ```
>
> That does look like it would fall back on the refmap, but to be honest
> I'm not sure what is "correct" here :) I was hoping for more
> discussion of the questions I raised to see some thought about what we
> should or shouldn't do. I suppose falling back might be important for
> the later step with --limited-fetch, though?Without the fallback, @{upstream}, --delete-merged and "git branch --track" fail for refs fetched through the refmap.
I'll add tests to lock down that such refs are tracked through the refmap, and that refs excluded by a negative refspec in remote.<name>.fetch are not.
--limited-fetch does not need the fallback.
Harald