summaryrefslogtreecommitdiff
path: root/t/t2027-worktree-list.sh
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2016-11-28 09:36:56 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-11-28 21:18:51 (GMT)
commit4df1d4d4666eb26b420d5b386010470729846b8c (patch)
tree3326149c4a7e8c3927d56e1f2a0e04ba0f19c1ee /t/t2027-worktree-list.sh
parent4fff1ef7ffe0e370459242cf08c51177eeb4181f (diff)
downloadgit-4df1d4d4666eb26b420d5b386010470729846b8c.zip
git-4df1d4d4666eb26b420d5b386010470729846b8c.tar.gz
git-4df1d4d4666eb26b420d5b386010470729846b8c.tar.bz2
worktree list: keep the list sorted
It makes it easier to write tests for. But it should also be good for the user since locating a worktree by eye would be easier once they notice this. Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t2027-worktree-list.sh')
-rwxr-xr-xt/t2027-worktree-list.sh19
1 files changed, 19 insertions, 0 deletions
diff --git a/t/t2027-worktree-list.sh b/t/t2027-worktree-list.sh
index 98b5f34..465eeea 100755
--- a/t/t2027-worktree-list.sh
+++ b/t/t2027-worktree-list.sh
@@ -117,4 +117,23 @@ test_expect_success 'broken main worktree still at the top' '
)
'
+test_expect_success 'linked worktrees are sorted' '
+ mkdir sorted &&
+ git init sorted/main &&
+ (
+ cd sorted/main &&
+ test_tick &&
+ test_commit new &&
+ git worktree add ../first &&
+ git worktree add ../second &&
+ git worktree list --porcelain | grep ^worktree >actual
+ ) &&
+ cat >expected <<-EOF &&
+ worktree $(pwd)/sorted/main
+ worktree $(pwd)/sorted/first
+ worktree $(pwd)/sorted/second
+ EOF
+ test_cmp expected sorted/main/actual
+'
+
test_done