From: Ben Knoble Date: Sun, 14 Sep 2025 19:03:32 GMT Subject: Re: [PATCH 1/3] checkout: provide hint when failing due to another worktree Message-ID: <6B2DF1C9-8745-4733-8082-9C37BEF12150@gmail.com> In-Reply-To: > Le 13 sept. 2025 à 16:56, Kristoffer Haugsbakk a écrit : > > Unrelated: I found it confusing that my `co = checkout` alias did not > work with this fresh-off-the-press Advice:[1] > > ``` > $ ./git co master > fatal: 'master' is already used by worktree at '' > $ ./git checkout master > fatal: 'master' is already used by worktree at '' > hint: Use --detach to avoid this restriction, > hint: or --ignore-other-worktrees to ignore it. > hint: Disable this message with "git config set advice.branchUsedInOtherWorktree false" > ``` > > But it did for this older Advice (which is in my installed git(1)): > > ``` > $ ./git co -b .. @ > fatal: '..' is not a valid branch name > hint: See `man git check-ref-format` > hint: Disable this message with "git config set advice.refSyntax false" > ``` > > It’s because aliases are run as a subprocess from the `git` in `PATH`: > > ``` > strvec_push(&cmd.args, "git"); > ``` > > [1]: Chain of events: > > 1. Try to trigger the Advice in this series > 2. ... but it doesn’t > 3. Is the code wrong? > 4. Wait, I’m using my alias (which I always use; I don’t think about it) > 5. I test with `git checkout`: it works > 6. ... so aliases don’t work with Advice? > 7. Test an existing Advice that I know about > 8. ... but it does work with aliases > 9.–15. ... > > It was part of the process. I didn’t *decide* to get hung up on it. ;) Using bin-wrappers/git should set things up correctly, I think?