To help users discern large chunks of white text (when the push succeeds) from large chunks of white text (when the push fails), let's add some color to the latter. The original contribution came in via Pull Request from the Git for Windows project: https://github.com/git-for-windows/git/pull/1429 I almost forgot to submit v3. Guess it's a good thing I have a project management system with tickets I can move through a story board... Changes since v2: - removed a bogus "squash! ..." from the commit message of 2/4 - removed the unnecessary here-doc from the test added in 4/4 - renamed color.advice.advice to color.advice.hint in 2/4 and 4/4 Johannes Schindelin (3): color: introduce support for colorizing stderr Add a test to verify that push errors are colorful Document the new color.* settings to colorize push errors/hints Ryan Dammrose (1): push: colorize errors Documentation/config.txt | 28 ++++++++++++++++ advice.c | 49 ++++++++++++++++++++++++++-- builtin/push.c | 44 ++++++++++++++++++++++++- color.c | 20 +++++++----- color.h | 4 ++- config.c | 2 +- t/t5541-http-push-smart.sh | 12 +++++++ transport.c | 67 +++++++++++++++++++++++++++++++++++++- 8 files changed, 211 insertions(+), 15 deletions(-) base-commit: fe0a9eaf31dd0c349ae4308498c33a5c3794b293 Published-As: https://github.com/dscho/git/releases/tag/colorize-push-errors-v3 Fetch-It-Via: git fetch https://github.com/dscho/git colorize-push-errors-v3 Interdiff vs v2: diff --git a/Documentation/config.txt b/Documentation/config.txt index 1fef60a7301..2cea0c6c899 100644 --- a/Documentation/config.txt +++ b/Documentation/config.txt @@ -1095,7 +1095,7 @@ color.advice:: are used only when the error output goes to a terminal. If unset, then the value of `color.ui` is used (`auto` by default). -color.advice.advice:: +color.advice.hint:: Use customized color for hints. color.branch:: diff --git a/advice.c b/advice.c index 2121c1811fd..89fda1de55b 100644 --- a/advice.c +++ b/advice.c @@ -36,7 +36,7 @@ static int parse_advise_color_slot(const char *slot) { if (!strcasecmp(slot, "reset")) return ADVICE_COLOR_RESET; - if (!strcasecmp(slot, "advice")) + if (!strcasecmp(slot, "hint")) return ADVICE_COLOR_HINT; return -1; } diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh index 1c2be98dc2b..a2af693068f 100755 --- a/t/t5541-http-push-smart.sh +++ b/t/t5541-http-push-smart.sh @@ -379,12 +379,6 @@ test_expect_success 'push status output scrubs password' ' test_expect_success 'colorize errors/hints' ' cd "$ROOT_PATH"/test_repo_clone && - cat >exp <<-EOF && - To http://127.0.0.1:$LIB_HTTPD_PORT/smart/test_repo.git - <RED>! [rejected] <RESET> origin/master^ -> master (non-fast-forward) - error: failed to push some refs to '\''http://127.0.0.1:$LIB_HTTPD_PORT/smart/test_repo.git'\'' - EOF - test_must_fail git -c color.transport=always -c color.advice=always \ -c color.push=always \ push origin origin/master^:master 2>act && -- 2.17.0.windows.1.15.gaa56ade3205