test-lib: make "-x" work with "--verbose-log"

The "-x" tracing option implies "--verbose". This is a problem when running under a TAP harness like "prove", where we need to use "--verbose-log" instead. Instead, let's handle this the same way we do for --valgrind, including the recent fix from 88c6e9d31c (test-lib: --valgrind should not override --verbose-log, 2017-09-05). Namely, let's enable --verbose only when we know there isn't a more specific verbosity option indicated. Note that we also have to tweak `want_trace` to turn it on (previously we just lumped $verbose_log in with $verbose, but now we don't necessarily auto-set the latter). Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Dec 8, 2017 at 05:47 UTC f5ba2de6bc67082d01742ee6ce892fbcff7b97af
1 file changed +8 -2
t/test-lib.sh
+8 -2
@@ -264,7 +264,6 @@ do
264 shift ;;
265 -x)
266 trace=t
267 - verbose=t
267 shift ;;
268 --verbose-log)
269 verbose_log=t
@@ -283,6 +282,11 @@ then
282 test -z "$verbose_log" && verbose=t
283 fi
284
285 +if test -n "$trace" && test -z "$verbose_log"
286 +then
287 + verbose=t
288 +fi
289 +
290 if test -n "$color"
291 then
292 # Save the color control sequences now rather than run tput
@@ -586,7 +590,9 @@ maybe_setup_valgrind () {
590 }
591
592 want_trace () {
589 - test "$trace" = t && test "$verbose" = t
593 + test "$trace" = t && {
594 + test "$verbose" = t || test "$verbose_log" = t
595 + }
596 }
597
598 # This is a separate function because some tests use