Git development
 help / color / mirror / Atom feed
* [RFC] pull: custom fetch refspecs and fork-point lookup
@ 2026-10-13 16:01 jyotish kumar
  2026-10-14 19:07 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: jyotish kumar @ 2026-10-13 16:01 UTC (permalink / raw)
  To: git

Hi,

While reading `builtin/pull.c`, I came across a FIXME in
`get_tracking_branch()` concerning the assumption that remote branches
follow the default mapping from `refs/heads/<branch>` to
`refs/remotes/<remote>/<branch>`.

I investigated how this assumption relates to custom fetch refspecs
and noticed a potentially subtle issue.

For example, a remote can be configured with the following fetch refspec:

`+refs/heads/*:refs/remotes/origin/custom/*`

With this configuration, the remote-tracking ref for the `main` branch
is `refs/remotes/origin/custom/main`, rather than
`refs/remotes/origin/main`.

Since `get_tracking_branch()` is used by `get_rebase_fork_point()`
when determining the fork point for `git pull --rebase`, I am
wondering whether this assumption could cause the fork-point lookup to
use an incorrect or nonexistent remote-tracking ref when a custom
fetch refspec is configured.

From my investigation of Git's remote and refspec APIs, it seems that
resolving the configured fetch mapping may be a more reliable approach
than assuming the default remote-tracking ref layout.

Does this analysis sound correct? I would appreciate feedback on
whether this is a real issue and whether resolving the configured
fetch mapping would be the right direction to address it.

Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [RFC] pull: custom fetch refspecs and fork-point lookup
  2026-10-13 16:01 [RFC] pull: custom fetch refspecs and fork-point lookup jyotish kumar
@ 2026-10-14 19:07 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2026-10-14 19:07 UTC (permalink / raw)
  To: jyotish kumar; +Cc: git, Harald Nordgren

jyotish kumar <jyotishkumar725015@gmail.com> writes:

> While reading `builtin/pull.c`, I came across a FIXME in
> `get_tracking_branch()` concerning the assumption that remote branches
> follow the default mapping from `refs/heads/<branch>` to
> `refs/remotes/<remote>/<branch>`.
> ...
> Does this analysis sound correct? I would appreciate feedback on
> whether this is a real issue and whether resolving the configured
> fetch mapping would be the right direction to address it.

The reason the "FIXME" you noticed exists is that the assumption the
code makes is broken.  Assuming that refs/remotes/<remote>/<branch>
tracks <branch> from <remote> would break when a customized fetch
refspec is used.

I vaguely recall mentioning a similar "map between a remote-tracking
branch and a branch at the remote" issue while discussing a recent
work by Harald to narrow a "git fetch" that does not specify what to
fetch, but I cannot find a mailing list archive reference, sorry.


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-10-14 19:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-13 16:01 [RFC] pull: custom fetch refspecs and fork-point lookup jyotish kumar
2026-10-14 19:07 ` Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox