git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[RFC] pull: custom fetch refspecs and fork-point lookup

From
JKjyotish kumar <jyotishkumar725015@gmail.com>
Date
Oct 13, 2026, 16:01 UTC
Message-ID
<CAGjZMyTQt2XEF69pJWHA=diRjoidixGs48E1vA0ytGUgZYOZNQ@mail.gmail.com>
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!
Next: Junio C Hamano
Message 1 of 7 in “[RFC] pull: custom fetch refspecs and fork-point lookup”
  1. jyotish kumarOct 13, 2026
  2. Junio C HamanoOct 14, 2026
  3. Harald NordgrenOct 15, 2026
  4. jyotish kumarOct 15, 2026
  5. Junio C HamanoOct 15, 2026
  6. jyotish kumarOct 16, 2026
  7. Junio C HamanoOct 16, 2026

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.