Re: [PATCH v2 3/4] Add a test to verify that push errors are colorful

2018-04-06 Thread Johannes Schindelin
Hi Eric,


On Fri, 6 Apr 2018, Eric Sunshine wrote:

> On Thu, Apr 5, 2018 at 6:48 PM, Johannes Schindelin
>  wrote:
> > 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 
> > ---
> > diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
> > @@ -377,5 +377,23 @@ 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
> > +! [rejected]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
> 
> This "exp" file is not used by the test.

Indeed! I was *so* sure I had removed it, but a `git stash` must have made
that change go away before I could commit it.

Will be fixed in v3.

Ciao,
Dscho


Re: [PATCH v2 3/4] Add a test to verify that push errors are colorful

2018-04-06 Thread Eric Sunshine
On Thu, Apr 5, 2018 at 6:48 PM, Johannes Schindelin
 wrote:
> 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 
> ---
> diff --git a/t/t5541-http-push-smart.sh b/t/t5541-http-push-smart.sh
> @@ -377,5 +377,23 @@ 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
> +! [rejected]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

This "exp" file is not used by the test.

> +   test_must_fail git -c color.transport=always -c color.advice=always \
> +   -c color.push=always \
> +   push origin origin/master^:master 2>act &&
> +   test_decode_color decoded &&
> +   test_i18ngrep ".*rejected.*" decoded &&
> +   test_i18ngrep "error: failed to push some refs" decoded &&
> +   test_i18ngrep "hint: " decoded &&
> +   test_i18ngrep ! "^hint: " decoded
> +'