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>
This commit is contained in:
SZEDER Gábor 2018-02-08 16:56:51 +01:00 committed by Junio C Hamano
parent cc04adc2d0
commit 3b85ec34b8

View file

@ -134,11 +134,15 @@ test_expect_success 'favour same basenames over different ones' '
git rm path1 &&
mkdir subdir &&
git mv another-path subdir/path1 &&
git status | test_i18ngrep "renamed: .*path1 -> subdir/path1"'
git status >out &&
test_i18ngrep "renamed: .*path1 -> subdir/path1" out
'
test_expect_success 'favour same basenames even with minor differences' '
git show HEAD:path1 | sed "s/15/16/" > subdir/path1 &&
git status | test_i18ngrep "renamed: .*path1 -> subdir/path1"'
git status >out &&
test_i18ngrep "renamed: .*path1 -> subdir/path1" out
'
test_expect_success 'two files with same basename and same content' '
git reset --hard &&
@ -148,7 +152,8 @@ test_expect_success 'two files with same basename and same content' '
git add dir &&
git commit -m 2 &&
git mv dir other-dir &&
git status | test_i18ngrep "renamed: .*dir/A/file -> other-dir/A/file"
git status >out &&
test_i18ngrep "renamed: .*dir/A/file -> other-dir/A/file" out
'
test_expect_success 'setup for many rename source candidates' '