Skip to content

Commit 3b85ec3

Browse files
szedergitster
authored andcommitted
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 <[email protected]> Reviewed-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent cc04adc commit 3b85ec3

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

t/t4001-diff-rename.sh

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,15 @@ test_expect_success 'favour same basenames over different ones' '
134134
git rm path1 &&
135135
mkdir subdir &&
136136
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+
'
138140

139141
test_expect_success 'favour same basenames even with minor differences' '
140142
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+
'
142146

143147
test_expect_success 'two files with same basename and same content' '
144148
git reset --hard &&
@@ -148,7 +152,8 @@ test_expect_success 'two files with same basename and same content' '
148152
git add dir &&
149153
git commit -m 2 &&
150154
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
152157
'
153158

154159
test_expect_success 'setup for many rename source candidates' '

0 commit comments

Comments
 (0)