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

[PATCH 0/5] branch: Fix --track on a remote-tracking non-branch

From
Johan Herland <johan@herland.net>
Date
Sep 6, 2013, 10:40 UTC
Message-ID
<1378464042-17476-1-git-send-email-johan@herland.net>
Hi,

Per Cederqvist alerted me to a change in v1.8.3.2 that broke his build/test infrastructure. Specifically, before 41c21f2 (branch.c: Validate tracking branches with refspecs instead of refs/remotes/*) Git allowed a local branch to --track anything within refs/remotes/*, and in 41c21f2, I changed the rules to require a configured remote with a matching fetch refspec when setting up the upstream configuration variables (so that there was no ambiguity on how to set branch.<name>.remote and branch.<name>.merge).

So far so good.

However, in addition to requiring a matching remote/refspec, I also (for reasons that are still unclear to me) added a requirement that the resulting remote ref name (to be stored into branch.<name>.merge) must start with "refs/heads/" (see the last line of branch.c:check_tracking_branch()).

Although it is typically the case that an upstream branch is a proper (refs/heads/*) branch in the remote repo (which explains why we have not noticed this until now), I think it is _wrong_ of Git to _require_ this when configuring the upstream.

Per's setup that triggered this series is described in more detail in patch #4/5 (which introduces a testcase illustrating the breakage), and the actual fix (which simply removes the extra refs/heads/* requirement on the remote ref) is in patch #5/5.

The two first patches are unrelated trivial fixes that I encountered while working on this, and patch #3 is a small documentation update suggested by Per.

...Johan
Johan Herland (4):
  t2024: Fix inconsequential typos
  t3200: Minor fix when preparing for tracking failure
  Refer to branch.<name>.remote/merge when documenting --track
  t3200: Add test demonstrating minor regression in 41c21f2
Per Cederqvist (1):
  branch.c: Relax unnecessary requirement on upstream's remote ref name
 Documentation/git-branch.txt |  6 ++++--
 branch.c                     |  3 +--
 t/t2024-checkout-dwim.sh     |  4 ++--
 t/t3200-branch.sh            | 37 ++++++++++++++++++++++++++++++++++++-
 4 files changed, 43 insertions(+), 7 deletions(-)

-- 1.8.3.GIT

Next: Johan Herland
Message 1 of 15 in “branch: Fix --track on a remote-tracking non-branch”
  1. 0/5 branch: Fix --track on a remote-tracking non-branchJohan Herland, Sep 6, 2013
  2. 1/5 t2024: Fix inconsequential typosJohan Herland, Sep 6, 2013
  3. Junio C HamanoSep 6, 2013
  4. Johan HerlandSep 6, 2013
  5. 2/5 t3200: Minor fix when preparing for tracking failureJohan Herland, Sep 6, 2013
  6. 3/5 Refer to branch.<name>.remote/merge when documenting --trackJohan Herland, Sep 6, 2013
  7. 4/5 t3200: Add test demonstrating minor regression in 41c21f2Johan Herland, Sep 6, 2013
  8. 5/5 branch.c: Relax unnecessary requirement on upstream's remote ref nameJohan Herland, Sep 6, 2013
  9. Junio C HamanoSep 6, 2013
  10. 0/5 branch: Fix --track on a remote-tracking non-branchJohan Herland, Sep 8, 2013
  11. 1/5 t2024: Fix &&-chaining and a couple of typosJohan Herland, Sep 8, 2013
  12. 2/5 t3200: Minor fix when preparing for tracking failureJohan Herland, Sep 8, 2013
  13. 3/5 Refer to branch.<name>.remote/merge when documenting --trackJohan Herland, Sep 8, 2013
  14. 4/5 t3200: Add test demonstrating minor regression in 41c21f2Johan Herland, Sep 8, 2013
  15. 5/5 branch.c: Relax unnecessary requirement on upstream's remote ref nameJohan Herland, Sep 8, 2013

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.