Skip to content

Commit 2cd6e1d

Browse files
sgngitster
authored andcommitted
t5534: split stdout and stderr redirection
On atomic pushing failure with GnuPG, we expect a very specific output in stdout due to `--porcelain` switch. On such failure, we also write down some helpful hint into stderr in order to help user understand what happens and how to continue from those failures. On a lot of system, those hint (in stderr) will be flushed first, then those messages in stdout will be flushed. In such systems, the current test code is fine as is. However, we don't have such guarantee, (at least) there're some real systems that writes those stream interleaved. On such systems, we may see the stderr stream written in the middle of stdout stream. Let's split those stream redirection. By splitting those stream, the output stream will contain exactly what we want to compare, thus, saving us a "sed" invocation. While we're at it, change the `test_i18ncmp` to `test_cmp` because we will never translate those messages (because of `--porcelain`). Signed-off-by: Đoàn Trần Công Danh <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent a4f324a commit 2cd6e1d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

t/t5534-push-signed.sh

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -282,18 +282,17 @@ test_expect_success GPG 'failed atomic push does not execute GPG' '
282282
EOF
283283
test_must_fail env PATH="$TRASH_DIRECTORY:$PATH" git push \
284284
--signed --atomic --porcelain \
285-
dst noop ff noff >out 2>&1 &&
285+
dst noop ff noff >out 2>err &&
286286
287-
test_i18ngrep ! "gpg failed to sign" out &&
288-
sed -n -e "/^To dst/,$ p" out >actual &&
287+
test_i18ngrep ! "gpg failed to sign" err &&
289288
cat >expect <<-EOF &&
290289
To dst
291290
= refs/heads/noop:refs/heads/noop [up to date]
292291
! refs/heads/ff:refs/heads/ff [rejected] (atomic push failed)
293292
! refs/heads/noff:refs/heads/noff [rejected] (non-fast-forward)
294293
Done
295294
EOF
296-
test_i18ncmp expect actual
295+
test_cmp expect out
297296
'
298297

299298
test_done

0 commit comments

Comments
 (0)