Skip to contentSkip to conversation

t2402: test worktree path when called in .git directory

PATCH In review Hariom Verma via GitGitGadget 3 participants 3 messages Mar 4, 2020

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t2402: test worktree path when called in .git directory

From: Hariom Verma <[email protected]>

The bug which reports an extra /.git/. in worktree path when called in '.git' directory already has been fixed. But unfortunately, the regression test to ensure this behavior has been forgotten.
Here is that test.

---
t2402: test worktree path when called in .git directory

Regression test to ensure that the bug (i.e. extra /.git/. in worktree path when called in '.git' directory) has been fixed correctly.

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-570%2Fharry-hov%2Fverify-get_main_worktree-fix-v1
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-570/harry-hov/verify-get_main_worktree-fix-v1
Pull-Request: https://github.com/gitgitgadget/git/pull/570

 t/t2402-worktree-list.sh | 6 ++++++
 1 file changed, 6 insertions(+)
t/t2402-worktree-list.sh +6 -0
index bb6fb9b12cb..ef397386dc7 100755
@@ -151,4 +151,10 @@ test_expect_success 'linked worktrees are sorted' '
 	test_cmp expected sorted/main/actual
 '
 
+test_expect_success 'worktree path when called in .git directory' '
+	git worktree list> list1 &&
+	git -C .git worktree list> list2 &&
+	test_cmp list1 list2
+'
+
 test_done

base-commit: 4ef346482d6d5748861c1aa9d56712e847369b40

Signature · 1 line
gitgitgadget
#1 lore raw
Quoted 4 lines · Hariom Verma via GitGitGadget

The bug which reports an extra /.git/. in worktree path when called in '.git' directory already has been fixed. But unfortunately, the regression test to ensure this behavior has been forgotten.
Here is that test.

For readers not involved in the discussion, this test was requested by [1], but the topic graduated to "next" before it could be re-rolled. It probably ought to be queued atop 'hv/receive-denycurrent-everywhere'.

[1]: https://lore.kernel.org/git/CAPig+cTh-uu-obh9aeDOV9ptbVwRmkujgucbu9ei1Qa3qSNG_A@mail.gmail.com/

t/t2402-worktree-list.sh test_expect_success 'linked worktrees are sorted' ' · line 153

Quoted 7 lines

---

t/t2402-worktree-list.sh +3 -0
@@ -151,4 +151,10 @@ test_expect_success 'linked worktrees are sorted' '
+test_expect_success 'worktree path when called in .git directory' '
+       git worktree list> list1 &&
+       git -C .git worktree list> list2 &&

Nit: Style is for the redirection operator to stick to the file:

    git worktree list >list1 &&
    git -C .git worktree list >list2 &&

t/t2402-worktree-list.sh test_expect_success 'linked worktrees are sorted' ' · line 158

Quoted 2 lines
t/t2402-worktree-list.sh +2 -0
+       test_cmp list1 list2
+'

The test itself makes sense.

#2 lore raw
Quoted 7 lines · Eric Sunshine
Quoted 4 lines · Hariom Verma via GitGitGadget

The bug which reports an extra /.git/. in worktree path when called in '.git' directory already has been fixed. But unfortunately, the regression test to ensure this behavior has been forgotten.
Here is that test.

Quoted 6 lines

For readers not involved in the discussion, this test was requested by [1], but the topic graduated to "next" before it could be re-rolled. It probably ought to be queued atop 'hv/receive-denycurrent-everywhere'.

[1]: https://lore.kernel.org/git/CAPig+cTh-uu-obh9aeDOV9ptbVwRmkujgucbu9ei1Qa3qSNG_A@mail.gmail.com/

Your notes to those watching from sidelines are greatly appreciated.

Quoted 9 lines

t/t2402-worktree-list.sh test_expect_success 'linked worktrees are sorted' ' · line 153

Quoted 7 lines

---

t/t2402-worktree-list.sh +3 -0
@@ -151,4 +151,10 @@ test_expect_success 'linked worktrees are sorted' '
+test_expect_success 'worktree path when called in .git directory' '
+       git worktree list> list1 &&
+       git -C .git worktree list> list2 &&

Nit: Style is for the redirection operator to stick to the file:

;-) Thanks for being a careful reader.

Quoted 7 lines
    git worktree list >list1 &&
    git -C .git worktree list >list2 &&

t/t2402-worktree-list.sh test_expect_success 'linked worktrees are sorted' ' · line 158

Quoted 2 lines
t/t2402-worktree-list.sh +2 -0
+       test_cmp list1 list2
+'

The test itself makes sense.