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

Re: switch/checkout stops halfway when it fails to write tracking config

From
D. Ben Knoble <ben.knoble@gmail.com>
Date
Oct 20, 2026, 13:06 UTC
Message-ID
<CALnO6CCFfd3VcZkFGmc6kYHqEwsafa7UbOg-6cN0jEfsipQm5Q@mail.gmail.com>
In-Reply-To
<CAP8tz2JPXzq=Skokn4OtH8t6c3b+p1Wny1iX6AhXReUGvsBhuw@mail.gmail.com>
On Mon, Oct 19, 2026 at 9:41 PM 井上司 <inoue.tsukasa.4@gmail.com> wrote:
Show 7 quoted lines
>
> 5. Root cause
> update_refs_for_switch() -> create_branch() -> setup_tracking() fails to write
> the config, and the code calls exit(1) in setup_tracking() (branch.c). At that
> point the worktree and the branch have been changed, but HEAD has not. This
> exit was introduced in 27852b2c53 (branch: report errors in tracking branch
> setup, 2016-02-22).

I can see where create_branch() is called prior to setting up HEAD, but I'm mildly confused about the index/wt updates prior to either! It seems to me that should be one of the last steps, hm. Unfortunately, I'm having a hard time finding the responsible code outside of the "merge" case (which probably has a similar issue).

-- 
D. Ben Knoble
Previous: Junio C HamanoNext: 井上司
Message 5 of 9 in “switch/checkout stops halfway when it fails to write tracking config”
  1. 井上司Oct 20, 2026
  2. Junio C HamanoOct 20, 2026
  3. 井上司Oct 20, 2026
  4. Junio C HamanoOct 21, 2026
  5. D. Ben KnobleOct 20, 2026
  6. 井上司Oct 20, 2026
  7. D. Ben KnobleOct 22, 2026
  8. 井上司Oct 22, 2026
  9. 井上司Nov 8, 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.