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>
This commit is contained in:
Jeff King 2017-12-08 05:47:17 -05:00 коммит произвёл Junio C Hamano
Родитель 9be795fbce
Коммит f5ba2de6bc
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -264,7 +264,6 @@ do
shift ;;
-x)
trace=t
verbose=t
shift ;;
--verbose-log)
verbose_log=t
@ -283,6 +282,11 @@ then
test -z "$verbose_log" && verbose=t
fi
if test -n "$trace" && test -z "$verbose_log"
then
verbose=t
fi
if test -n "$color"
then
# Save the color control sequences now rather than run tput
@ -586,7 +590,9 @@ maybe_setup_valgrind () {
}
want_trace () {
test "$trace" = t && test "$verbose" = t
test "$trace" = t && {
test "$verbose" = t || test "$verbose_log" = t
}
}
# This is a separate function because some tests use