Re: [PATCH v2 3/5] worktree: add tests for worktrees with relative paths
From: Taylor Blau <hidden>
Date: 2024-10-29 23:00:12
On Mon, Oct 28, 2024 at 07:09:52PM +0000, Caleb White wrote:
quoted hunk ↗ jump to hunk
This patch expands the test coverage by adding cases that specifically handle relative paths. These tests verify correct behavior in a variety of operations, including: adding, listing, pruning, moving, and repairing worktrees with relative paths configured. This also adds a test case for reinitializing a repository that has relative worktrees. Signed-off-by: Caleb White <redacted> --- t/t0001-init.sh | 17 +++++++++++++---- t/t2400-worktree-add.sh | 41 +++++++++++++++++++++++++++++++++++++++++ t/t2401-worktree-prune.sh | 3 ++- t/t2402-worktree-list.sh | 22 ++++++++++++++++++++++ t/t2403-worktree-move.sh | 22 ++++++++++++++++++++++ t/t2406-worktree-repair.sh | 26 ++++++++++++++++++++++++++ 6 files changed, 126 insertions(+), 5 deletions(-)diff --git a/t/t0001-init.sh b/t/t0001-init.sh index 0178aa62a41f1606f2382a4a10ab593ccf11e0e8..e21b9aa5e7f4599af8b20165b50896c9a49ba7ea 100755 --- a/t/t0001-init.sh +++ b/t/t0001-init.sh@@ -435,6 +435,7 @@ sep_git_dir_worktree () { test_when_finished "rm -rf mainwt linkwt seprepo" && git init mainwt && test_commit -C mainwt gumby && + git -C mainwt config worktree.useRelativePaths "$([ "$2" = "relative" ] && echo true || echo false)" &&
Can we avoid using '[' and perhaps split this out a little further.
Perhaps:
if test "relative" = $2
then
git -C mainwt config worktree.useRelativePaths true
else
git -C mainwt config worktree.useRelativePaths false
fi
I think the duplication is more than worth the clarity here.
Thanks,
Taylor