All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: "Anders Kaseorg" <andersk@mit.edu>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] t2401: fix misfiring substitution when path contains w2
Date: Wed, 11 Nov 2026 08:51:03 -0800	[thread overview]
Message-ID: <xmqqjymjnwg8.fsf@gitster.g> (raw)
In-Reply-To: <20261110-t2401-substitution-v1-1-32f3524f2b92@mit.edu> (Anders Kaseorg's message of "Tue, 10 Nov 2026 23:55:58 -0800")

"Anders Kaseorg" <andersk@mit.edu> writes:

> -	sed "s/w2/w1/" .git/worktrees/w2/gitdir >.git/worktrees/w2/gitdir.new &&
> -	mv .git/worktrees/w2/gitdir.new .git/worktrees/w2/gitdir &&

So we used to fabricate a new file by replacing the first substring
"w2" to "w1".  Of course, if that "w2" is not the one we hyave in mind
but came from somewhere before ".../t/trash directory/", it would
not work.  Well spotted.

> +	cp .git/worktrees/w1/gitdir .git/worktrees/w2/gitdir &&

We have created a separate worktree "w1" just next to "w2", so
reusing what its gitdir says would give us the same.  The "correct"
contents of w2/gitdif should point at "w2/.git" (with its full path)
but this "clobbered" file should point at "w1/.git" (which was what
the sed script was trying to do).

Makes sense.

>  	git worktree prune --verbose 2>actual &&
>  	test_i18ngrep "duplicate entry" actual &&
>  	test -d .git/worktrees/w1 &&
>
> ---
> base-commit: da8fb6be5594b4a06ef2cc2ff7a5363a6fac2b5a
> change-id: 20261110-t2401-substitution-3ab4819833a1
>
> Best regards,
> --  
> Anders Kaseorg <andersk@mit.edu>

      reply	other threads:[~2026-11-11 16:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-11  7:55 [PATCH] t2401: fix misfiring substitution when path contains w2 Anders Kaseorg
2026-11-11 16:51 ` Junio C Hamano [this message]

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=xmqqjymjnwg8.fsf@gitster.g \
    --to=gitster@pobox.com \
    --cc=andersk@mit.edu \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.