Git development
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "tsukasa-ino via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org,  Harald Nordgren <haraldnordgren@gmail.com>,
	tsukasa-ino <inoue.tsukasa.4@gmail.com>
Subject: Re: [PATCH v2 0/3] checkout: finish switch when tracking config cannot be written
Date: Wed, 21 Oct 2026 15:20:46 -0700	[thread overview]
Message-ID: <xmqq7bjalmpt.fsf@gitster.g> (raw)
In-Reply-To: <pull.2268.v2.git.1792618518.gitgitgadget@gmail.com> (tsukasa-ino via GitGitGadget's message of "Wed, 21 Oct 2026 21:35:15 +0000")

"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.

  parent reply	other threads:[~2026-10-21 22:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-20  1:15 [PATCH] branch: strip refs/heads/ from the --set-upstream-to hint tsukasa-ino via GitGitGadget
2026-10-20 19:51 ` Junio C Hamano
2026-10-21  7:05 ` Harald Nordgren
2026-10-21 21:35 ` [PATCH v2 0/3] checkout: finish switch when tracking config cannot be written tsukasa-ino via GitGitGadget
2026-10-21 21:35   ` [PATCH v2 1/3] branch: strip refs/heads/ from the --set-upstream-to hint tsukasa inoue via GitGitGadget
2026-10-21 21:35   ` [PATCH v2 2/3] branch: return an error from setup_tracking() tsukasa inoue via GitGitGadget
2026-10-21 21:35   ` [PATCH v2 3/3] checkout: finish switching when the tracking config cannot be written tsukasa inoue via GitGitGadget
2026-10-21 22:20   ` Junio C Hamano [this message]
2026-10-22  2:17     ` [PATCH v2 0/3] checkout: finish switch when " 井上司

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqq7bjalmpt.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=haraldnordgren@gmail.com \
    --cc=inoue.tsukasa.4@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox