public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Ben Knoble <ben.knoble@gmail•com>
To: Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail•com>
Cc: Gabriel Scherer <gabriel.scherer@inria•fr>,
	git@vger•kernel.org, Junio C Hamano <gitster@pobox•com>,
	Phillip Wood <phillip.wood@dunelm•org.uk>
Subject: Re: [PATCH 1/3] checkout: provide hint when failing due to another worktree
Date: Sun, 14 Sep 2025 15:03:32 -0400	[thread overview]
Message-ID: <6B2DF1C9-8745-4733-8082-9C37BEF12150@gmail.com> (raw)
In-Reply-To: <be510685-3be1-4f71-806a-6b580bb1cf21@app.fastmail.com>


> Le 13 sept. 2025 à 16:56, Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail•com> 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?

  parent reply	other threads:[~2025-09-14 19:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-13 14:13 [PATCH 0/3] extend --ignore-other-worktrees to 'rebase', add hints Gabriel Scherer
2025-09-13 14:13 ` [PATCH 1/3] checkout: provide hint when failing due to another worktree Gabriel Scherer
2025-09-13 20:55   ` Kristoffer Haugsbakk
2025-09-14  7:50     ` Gabriel Scherer
2025-09-15  8:53       ` Junio C Hamano
2025-09-15 19:52         ` Gabriel Scherer
2025-09-16  5:32           ` Junio C Hamano
2025-09-17 14:17           ` Junio C Hamano
2025-09-17 15:25           ` Gabriel Scherer
2025-09-19 14:13             ` Phillip Wood
2025-09-14 19:03     ` Ben Knoble [this message]
2025-09-14 19:06       ` Ben Knoble
2025-09-14 19:32       ` Kristoffer Haugsbakk
2025-09-13 14:13 ` [PATCH 2/3] rebase: support --ignore-other-worktrees Gabriel Scherer
2025-09-15 10:09   ` Phillip Wood
2025-09-15 16:23     ` Junio C Hamano
2025-09-13 14:13 ` [PATCH 3/3] rebase: hint when failing on branch used by another worktree Gabriel Scherer
2025-09-13 19:30 ` [PATCH 0/3] extend --ignore-other-worktrees to 'rebase', add hints Ben Knoble
2025-09-13 20:02   ` Gabriel Scherer
2025-09-15 10:09 ` Phillip Wood

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=6B2DF1C9-8745-4733-8082-9C37BEF12150@gmail.com \
    --to=ben.knoble@gmail$(echo .)com \
    --cc=gabriel.scherer@inria$(echo .)fr \
    --cc=git@vger$(echo .)kernel.org \
    --cc=gitster@pobox$(echo .)com \
    --cc=kristofferhaugsbakk@fastmail$(echo .)com \
    --cc=phillip.wood@dunelm$(echo .)org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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