Re: [PATCH 1/3] checkout: provide hint when failing due to another worktree
- From
- Gabriel Scherer <gabriel.scherer@inria.fr>
- Date
- Sep 14, 2025, 07:50 UTC
- Message-ID
- <d44109a1-0ff5-49f8-885b-9aae195ec492@inria.fr>
- In-Reply-To
- <be510685-3be1-4f71-806a-6b580bb1cf21@app.fastmail.com>
Thanks for your feedback -- I fixed the sort order, and will try to reword the commit description as suggested.
On 13/09/2025 22:55, Kristoffer Haugsbakk wrote:
Show 13 quoted lines
>> + advise_if_enabled(
>> + ADVICE_BRANCH_USED_IN_OTHER_WORKTREE,
>> + _("Use --detach to avoid this restriction,\n"
>> + "or --ignore-other-worktrees to ignore it."));
>
> I don’t know if `--detach` will “avoid” the restriction. (In fact
> `--ignore-other-worktrees` might be the one that *avoids* it (turns it
> off)?)
>
> Technically the only point of being-on-a-branch is to be able to advance
> it. You know that. But does the advice-receiver? Because they might
> use the hint to get what they want immediately. Then later wonder why
> all the work they did on the branch “had no effect”.In my in-progress version of the patch, the reworded advice is as follows:
fatal: 'foo' is already used by worktree at '/home/gasche/Prog/foo' hint: If you want to proceed anyway, try again with --ignore-other-worktrees. hint: Changes to the branch will also impact the other worktrees. hint: hint: If you want to detach HEAD at that branch, try again with the --detach option.
(The last part is shown when ADVICE_SUGGEST_DETACHING_HEAD is enabled, and reuses the existing wording for that advice.)