t4001: don't run 'git status' upstream of a pipe

The primary purpose of three tests in 't4001-diff-rename.sh' is to check rename detection in 'git status', but all three do so by running 'git status' upstream of a pipe, hiding its exit code. Consequently, the test could continue even if 'git status' exited with error. Use an intermediate file between 'git status' and 'test_i18ngrep' to catch a potential failure of the former. Signed-off-by: SZEDER Gábor <szeder.dev@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

SZEDER Gábor committed Feb 8, 2018 at 16:56 UTC 3b85ec34b8448d0311ef20e225c76df11c006008
1 file changed +8 -3
t/t4001-diff-rename.sh
+8 -3
@@ -134,11 +134,15 @@ test_expect_success 'favour same basenames over different ones' '
134 git rm path1 &&
135 mkdir subdir &&
136 git mv another-path subdir/path1 &&
137 - git status | test_i18ngrep "renamed: .*path1 -> subdir/path1"'
137 + git status >out &&
138 + test_i18ngrep "renamed: .*path1 -> subdir/path1" out
139 +'
140
141 test_expect_success 'favour same basenames even with minor differences' '
142 git show HEAD:path1 | sed "s/15/16/" > subdir/path1 &&
141 - git status | test_i18ngrep "renamed: .*path1 -> subdir/path1"'
143 + git status >out &&
144 + test_i18ngrep "renamed: .*path1 -> subdir/path1" out
145 +'
146
147 test_expect_success 'two files with same basename and same content' '
148 git reset --hard &&
@@ -148,7 +152,8 @@ test_expect_success 'two files with same basename and same content' '
152 git add dir &&
153 git commit -m 2 &&
154 git mv dir other-dir &&
151 - git status | test_i18ngrep "renamed: .*dir/A/file -> other-dir/A/file"
155 + git status >out &&
156 + test_i18ngrep "renamed: .*dir/A/file -> other-dir/A/file" out
157 '
158
159 test_expect_success 'setup for many rename source candidates' '