Re: [PATCH v10 1/5] fetch: add remote.<name>.refmap
- From
D. Ben Knoble <ben.knoble@gmail.com>
- Date
- Oct 25, 2026, 14:14 UTC
- Message-ID
- <CALnO6CBAEB8=FfZfde0OWvfLJikVkXQ8itP9wZpGHxfxK+y_LQ@mail.gmail.com>
- In-Reply-To
- <CAHwyqnXWxiF6NLh3e4yGq6_y+=A+-_PwKF7D9DJJDxbk_0vF-g@mail.gmail.com>
On Sat, Oct 24, 2026 at 1:19 PM Harald Nordgren <haraldnordgren@gmail.com> wrote:
Show 37 quoted lines
>
> > 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?
-- D. Ben Knoble