Re: [PATCH 1/3] checkout: provide hint when failing due to another worktree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> Le 14 sept. 2025 à 15:03, Ben Knoble <ben.knoble@xxxxxxxxx> a écrit :
> 
> 
>> Le 13 sept. 2025 à 16:56, Kristoffer Haugsbakk <kristofferhaugsbakk@xxxxxxxxxxxx> 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 '<path>'
>> $ ./git checkout master
>> fatal: 'master' is already used by worktree at '<patch>'
>> 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?

Ok, just saw the other patch series and see how this could not work. Thanks. 




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux