aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2025-11-26 10:32:42 -0800
committerJunio C Hamano <gitster@pobox.com>2025-11-26 10:32:42 -0800
commitd65eab5d303aa63cf8e6f9556d7f984eac43d3ec (patch)
treeb4b461ec7e71dd68ccd0829a83f6557ee4b7087b /t
parente539545396d99a18835f0b1c09172082389bc9b5 (diff)
parent08dfa5983572645ae7cc51b49cadfdf216ecfec6 (diff)
downloadgit-d65eab5d303aa63cf8e6f9556d7f984eac43d3ec.tar.xz
Merge branch 'pw/worktree-list-display-width-fix'
"git worktree list" attempts to show paths to worktrees while aligning them, but miscounted display columns for the paths when non-ASCII characters were involved, which has been corrected. * pw/worktree-list-display-width-fix: worktree list: quote paths worktree list: fix column spacing
Diffstat (limited to 't')
-rwxr-xr-xt/t2402-worktree-list.sh37
1 files changed, 24 insertions, 13 deletions
diff --git a/t/t2402-worktree-list.sh b/t/t2402-worktree-list.sh
index 8ef1cad7f2..e0c6abd2f5 100755
--- a/t/t2402-worktree-list.sh
+++ b/t/t2402-worktree-list.sh
@@ -29,23 +29,34 @@ test_expect_success 'rev-parse --git-path objects linked worktree' '
test_cmp expect actual
'
-test_expect_success '"list" all worktrees from main' '
- echo "$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]" >expect &&
- test_when_finished "rm -rf here out actual expect && git worktree prune" &&
- git worktree add --detach here main &&
- echo "$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >>expect &&
- git worktree list >out &&
- sed "s/ */ /g" <out >actual &&
+test_expect_success '"list" all worktrees from main core.quotepath=false' '
+ test_config core.quotepath false &&
+ echo "$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]" >expect &&
+ test_when_finished "rm -rf áááá out actual expect && git worktree prune" &&
+ git worktree add --detach áááá main &&
+ echo "$(git -C áááá rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >>expect &&
+ git worktree list >actual &&
+ test_cmp expect actual
+'
+
+test_expect_success '"list" all worktrees from main core.quotepath=true' '
+ test_config core.quotepath true &&
+ echo "$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]" >expect &&
+ test_when_finished "rm -rf á out actual expect && git worktree prune" &&
+ git worktree add --detach á main &&
+ echo "\"$(git -C á rev-parse --show-toplevel)\" $(git rev-parse --short HEAD) (detached HEAD)" |
+ sed s/á/\\\\303\\\\241/g >>expect &&
+ git worktree list >actual &&
test_cmp expect actual
'
test_expect_success '"list" all worktrees from linked' '
- echo "$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]" >expect &&
- test_when_finished "rm -rf here out actual expect && git worktree prune" &&
- git worktree add --detach here main &&
- echo "$(git -C here rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >>expect &&
- git -C here worktree list >out &&
- sed "s/ */ /g" <out >actual &&
+ test_config core.quotepath false &&
+ echo "$(git rev-parse --show-toplevel) $(git rev-parse --short HEAD) [$(git symbolic-ref --short HEAD)]" >expect &&
+ test_when_finished "rm -rf áááá out actual expect && git worktree prune" &&
+ git worktree add --detach áááá main &&
+ echo "$(git -C áááá rev-parse --show-toplevel) $(git rev-parse --short HEAD) (detached HEAD)" >>expect &&
+ git -C áááá worktree list >actual &&
test_cmp expect actual
'