Re: [Outreachy][PATCH v4] t6050: avoid pipes with upstream Git commands
From: Chizoba ODINAKA <hidden>
Date: 2024-10-12 06:28:17
On Sat, 12 Oct 2024 at 06:35, Eric Sunshine [off-list ref] wrote:
On Fri, Oct 11, 2024 at 8:00 PM [off-list ref] wrote:quoted
In pipes, the exit code of a chain of commands is determined by the final command. In order not to miss the exit code of a failed Git command, avoid pipes instead write output of Git commands into a file. For better debugging experience, instances of "grep" were changed to "test_grep". "test_grep" provides more context in case of a failed "grep". Signed-off-by: Chizoba ODINAKA <redacted> ---diff --git a/t/t6050-replace.sh b/t/t6050-replace.sh@@ -344,7 +374,8 @@ test_expect_success 'test --format medium' ' - git replace -l --format medium | sort >actual && + git replace -l --format medium >actual && + sort actual -o actual && test_cmp expected actualAlthough `sort -o` is POSIX, it may not be supported by all platforms on which Git is built. Moreover, as far as I can tell, `sort -o` is not used at all in the Git test suite, so we should be wary of using it here. Therefore, rather than introducing a novel use of this command, which might possibly break on some platform, instead stick with what is known to work without problem: git replace -l --format medium >output && sort output >actual &&
Fixed. Thanks Eric.