Skip to content

Commit a8612f9

Browse files
committed
Add a test to verify that push errors are colorful
This actually only tests whether the push errors/hints are colored if the respective color.* config settings are `always`, but in the regular case they default to `auto` (in which case we color the messages when stderr is connected to an interactive terminal), therefore these tests should suffice. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 86e345f commit a8612f9

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

t/t5541-http-push-smart.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,5 +377,17 @@ test_expect_success 'push status output scrubs password' '
377377
grep "^To $HTTPD_URL/smart/test_repo.git" status
378378
'
379379

380+
test_expect_success 'colorize errors/hints' '
381+
cd "$ROOT_PATH"/test_repo_clone &&
382+
test_must_fail git -c color.transport=always -c color.advice=always \
383+
-c color.push=always \
384+
push origin origin/master^:master 2>act &&
385+
test_decode_color <act >decoded &&
386+
test_i18ngrep "<RED>.*rejected.*<RESET>" decoded &&
387+
test_i18ngrep "<RED>error: failed to push some refs" decoded &&
388+
test_i18ngrep "<YELLOW>hint: " decoded &&
389+
test_i18ngrep ! "^hint: " decoded
390+
'
391+
380392
stop_httpd
381393
test_done

0 commit comments

Comments
 (0)