зеркало из https://github.com/microsoft/git.git
test-lib-functions: remove test_subcommand_inexact
The implementation of test_subcommand_inexact() was originally
introduced in e4d0c11c0
(repack: respect kept objects with '--write-midx
-b', 2021-12-20) with the intention to allow finding a subcommand based
on an initial set of arguments. The inexactness was intended as a way to
allow flexible options beyond that initial set, as opposed to
test_subcommand() which requires that the full list of options is
provided in its entirety.
The implementation began by copying test_subcommand() and replaced the
repeated argument 'printf' statement to append ".*" instead of "," to
each argument. This caused it to be more flexible than initially
intended.
The previous change deleted the only use of test_subcommand_inexact, so
instead of editing the helper, delete it.
Helped-by: Taylor Blau <me@ttaylorr.com>
Signed-off-by: Derrick Stolee <derrickstolee@github.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Родитель
f1486203f5
Коммит
16dcec218b
|
@ -1788,40 +1788,6 @@ test_subcommand () {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Check that the given command was invoked as part of the
|
|
||||||
# trace2-format trace on stdin, but without an exact set of
|
|
||||||
# arguments.
|
|
||||||
#
|
|
||||||
# test_subcommand [!] <command> <args>... < <trace>
|
|
||||||
#
|
|
||||||
# For example, to look for an invocation of "git pack-objects"
|
|
||||||
# with the "--honor-pack-keep" argument, use
|
|
||||||
#
|
|
||||||
# GIT_TRACE2_EVENT=event.log git repack ... &&
|
|
||||||
# test_subcommand git pack-objects --honor-pack-keep <event.log
|
|
||||||
#
|
|
||||||
# If the first parameter passed is !, this instead checks that
|
|
||||||
# the given command was not called.
|
|
||||||
#
|
|
||||||
test_subcommand_inexact () {
|
|
||||||
local negate=
|
|
||||||
if test "$1" = "!"
|
|
||||||
then
|
|
||||||
negate=t
|
|
||||||
shift
|
|
||||||
fi
|
|
||||||
|
|
||||||
local expr=$(printf '"%s".*' "$@")
|
|
||||||
expr="${expr%,}"
|
|
||||||
|
|
||||||
if test -n "$negate"
|
|
||||||
then
|
|
||||||
! grep "\"event\":\"child_start\".*\[$expr\]"
|
|
||||||
else
|
|
||||||
grep "\"event\":\"child_start\".*\[$expr\]"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
# Check that the given command was invoked as part of the
|
# Check that the given command was invoked as part of the
|
||||||
# trace2-format trace on stdin.
|
# trace2-format trace on stdin.
|
||||||
#
|
#
|
||||||
|
|
Загрузка…
Ссылка в новой задаче