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

Re: [PATCH v2 0/3] checkout: finish switch when tracking config cannot be written

From
井井上司 <inoue.tsukasa.4@gmail.com>
Date
Oct 22, 2026, 02:17 UTC
Message-ID
<CAP8tz2KOXHLjc5V1o1tZZWSsgOjVrp-ekH7H5KszBGK+hRqwrg@mail.gmail.com>
In-Reply-To
<xmqq7bjalmpt.fsf@gitster.g>
Show 5 quoted lines
> I am not sure if these two should be part of the same topic as the
> first one, or they should be treated separately.  IOW, if the way
> these two patches implement the fix proves to be contentious, does
> it make sense to hold the change in 1/3 until 2&3/3 are resolved
> (and vice versa), or can they be treated as two separate issues?
Thanks for the question. I checked whether the patches can be split.
- 2/3 applies without 1/3.
- 3/3 conflicts with 1/3 only in t3200, because its new test is placed
  right after the one added by 1/3. The code does not depend on 1/3. The
  hint sentence in the 3/3 commit message assumes the corrected hint, but
  that is only a wording dependency.

So 1/3 can be taken on its own. 2/3 and 3/3 can be discussed separately, and changes to them do not need to hold up 1/3. I will resend 2/3 and 3/3 as a separate series on top of the current master, so that 1/3 can be applied first.

2026年10月22日(木) 7:20 Junio C Hamano <gitster@pobox.com>:
Show 36 quoted lines
>
> "tsukasa-ino via GitGitGadget" <gitgitgadget@gmail.com> writes:
>
> > When the tracking config cannot be written (for example, because
> > .git/config.lock exists), git switch -c and checkout -b stop halfway. The
> > worktree, the index and the new branch ref are already updated, but HEAD
> > stays on the old branch, and the changes are left staged. The hint printed
> > at that point was also wrong: it suggested origin/refs/heads/.
> >
> > 1/3 strips refs/heads/ from the hint. 2/3 makes setup_tracking() return an
> > error instead of calling exit(). No behavior change yet. 3/3 makes switch
> > and checkout finish the switch and exit with status 0, as push -u, clone and
> > fetch already do. git branch still fails.
> >
> > Changes since v1:
> >
> >  * 1/3: the test now compares the whole hint message, as suggested by Harald
> >    Nordgren. It also checks that the command in the hint works once the lock
> >    is removed, as suggested by Junio
> >    (https://lore.kernel.org/git/xmqq7bjcup46.fsf@gitster.g/).
>
> OK.
>
> >  * 2/3 and 3/3 are new. They implement the direction agreed on the bug
> >    report thread (https://lore.kernel.org/git/xmqqecdjsryk.fsf@gitster.g/).
>
> I am not sure if these two should be part of the same topic as the
> first one, or they should be treated separately.  IOW, if the way
> these two patches implement the fix proves to be contentious, does
> it make sense to hold the change in 1/3 until 2&3/3 are resolved
> (and vice versa), or can they be treated as two separate issues?
>
> > Making the switch fully atomic, so that a failure undoes the worktree, the
> > index, the ref and the config, is left for a separate topic.
>
> Sensible.
Previous: Junio C Hamano
Message 9 of 9 in “branch: strip refs/heads/ from the --set-upstream-to hint”
  1. branch: strip refs/heads/ from the --set-upstream-to hinttsukasa-ino via GitGitGadget, Oct 20, 2026
  2. Junio C HamanoOct 20, 2026
  3. Harald NordgrenOct 21, 2026
  4. 0/3 checkout: finish switch when tracking config cannot be writtentsukasa-ino via GitGitGadget, Oct 21, 2026
  5. 1/3 branch: strip refs/heads/ from the --set-upstream-to hinttsukasa inoue via GitGitGadget, Oct 21, 2026
  6. 2/3 branch: return an error from setup_tracking()tsukasa inoue via GitGitGadget, Oct 21, 2026
  7. 3/3 checkout: finish switching when the tracking config cannot be writtentsukasa inoue via GitGitGadget, Oct 21, 2026
  8. Junio C HamanoOct 21, 2026
  9. 井上司Oct 22, 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.