From: Caleb White <cdwhite3@pm.me>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Eric Sunshine <sunshine@sunshineco.com>,
Phillip Wood <phillip.wood123@gmail.com>,
shejialuo <shejialuo@gmail.com>,
Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
Caleb White <cdwhite3@pm.me>
Subject: [PATCH v3 4/5] worktree: add test for path handling in linked worktrees
Date: Fri, 25 Oct 2024 20:57:46 +0000 [thread overview]
Message-ID: <20241025-wt_relative_paths-v3-4-8860a5321c01@pm.me> (raw)
In-Reply-To: <20241025-wt_relative_paths-v3-0-8860a5321c01@pm.me>
A failure scenario reported in an earlier patch series[1] that several
`git worktree` subcommands failed or misbehaved when invoked from within
linked worktrees that used relative paths.
This adds a test that executes a `worktree prune` command inside both an
internally and an externally linked worktree and asserts that the other
worktree was not pruned.
[1]: https://lore.kernel.org/git/CAPig+cQXFy=xPVpoSq6Wq0pxMRCjS=WbkgdO+3LySPX=q0nPCw@mail.gmail.com/
Reported-by: Eric Sunshine <sunshine@sunshineco.com>
Signed-off-by: Caleb White <cdwhite3@pm.me>
---
t/t2401-worktree-prune.sh | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/t/t2401-worktree-prune.sh b/t/t2401-worktree-prune.sh
index 71aa9bcd620f8a504fe628a2d7332d8b47fd4701..5eb52b9abbf29514dc082c260ebb7a5e8e63aae0 100755
--- a/t/t2401-worktree-prune.sh
+++ b/t/t2401-worktree-prune.sh
@@ -120,4 +120,24 @@ test_expect_success 'prune duplicate (main/linked)' '
! test -d .git/worktrees/wt
'
+test_expect_success 'not prune proper worktrees inside linked worktree with relative paths' '
+ test_when_finished rm -rf repo wt_ext &&
+ git init repo &&
+ (
+ cd repo &&
+ git config worktree.useRelativePaths true &&
+ echo content >file &&
+ git add file &&
+ git commit -m msg &&
+ git worktree add ../wt_ext &&
+ git worktree add wt_int &&
+ cd wt_int &&
+ git worktree prune -v >out &&
+ test_must_be_empty out &&
+ cd ../../wt_ext &&
+ git worktree prune -v >out &&
+ test_must_be_empty out
+ )
+'
+
test_done
--
2.47.0
next prev parent reply other threads:[~2024-10-25 20:57 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-25 20:57 [PATCH v3 0/5] Optionally link worktrees with relative paths Caleb White
2024-10-25 20:57 ` [PATCH v3 1/5] worktree: refactor infer_backlink() to use strbuf* Caleb White
2024-10-25 20:57 ` [PATCH v3 2/5] worktree: support worktrees linked with relative paths Caleb White
2024-10-25 20:57 ` [PATCH v3 3/5] worktree: optionally link worktrees " Caleb White
2024-10-25 20:57 ` Caleb White [this message]
2024-10-25 20:57 ` [PATCH v3 5/5] worktree: add `relativeWorktrees` extension Caleb White
2024-10-25 20:59 ` [PATCH v3 0/5] Optionally link worktrees with relative paths Caleb White
2024-10-25 21:05 ` Taylor Blau
2024-10-25 21:11 ` Caleb White
2024-10-25 21:38 ` Taylor Blau
2024-10-25 22:34 ` Caleb White
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=20241025-wt_relative_paths-v3-4-8860a5321c01@pm.me \
--to=cdwhite3@pm.me \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kristofferhaugsbakk@fastmail.com \
--cc=phillip.wood123@gmail.com \
--cc=shejialuo@gmail.com \
--cc=sunshine@sunshineco.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).