[RFC] pull: custom fetch refspecs and fork-point lookup
flat view
From: jyotish kumar <hidden>
Date: 2026-10-13 16:01:21
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!