[PATCH v2 1/2] t0001: avoid pipes with Git on LHS
From: Shubham Mishra <hidden>
Date: 2022-02-23 11:54:32
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Shubham Mishra <hidden>
Date: 2022-02-23 11:54:32
Subsystem:
the rest · Maintainer:
Linus Torvalds
Pipes ignore error codes of LHS command and thu`s we should not use them with Git in tests. As an alternative, use a 'tmp' file to write the Git output so we can test the exit code. Signed-off-by: Shubham Mishra <redacted> --- t/t0001-init.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index 3235ab4d53..c7dd91cb80 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh@@ -489,11 +489,13 @@ test_expect_success 're-init from a linked worktree' ' git worktree add ../linked-worktree && mv .git/info/exclude expected-exclude && cp .git/config expected-config && - find .git/worktrees -print | sort >expected && + find .git/worktrees -print >tmp && + sort tmp >expected && git -C ../linked-worktree init && test_cmp expected-exclude .git/info/exclude && test_cmp expected-config .git/config && - find .git/worktrees -print | sort >actual && + find .git/worktrees -print >tmp && + sort tmp >actual && test_cmp expected actual ) '
--
2.25.1