Skip to content

Commit 16dcec2

Browse files
derrickstoleegitster
authored andcommitted
test-lib-functions: remove test_subcommand_inexact
The implementation of test_subcommand_inexact() was originally introduced in e4d0c11 (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 <[email protected]> Signed-off-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f148620 commit 16dcec2

File tree

1 file changed

+0
-34
lines changed

1 file changed

+0
-34
lines changed

t/test-lib-functions.sh

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1788,40 +1788,6 @@ test_subcommand () {
17881788
fi
17891789
}
17901790

1791-
# Check that the given command was invoked as part of the
1792-
# trace2-format trace on stdin, but without an exact set of
1793-
# arguments.
1794-
#
1795-
# test_subcommand [!] <command> <args>... < <trace>
1796-
#
1797-
# For example, to look for an invocation of "git pack-objects"
1798-
# with the "--honor-pack-keep" argument, use
1799-
#
1800-
# GIT_TRACE2_EVENT=event.log git repack ... &&
1801-
# test_subcommand git pack-objects --honor-pack-keep <event.log
1802-
#
1803-
# If the first parameter passed is !, this instead checks that
1804-
# the given command was not called.
1805-
#
1806-
test_subcommand_inexact () {
1807-
local negate=
1808-
if test "$1" = "!"
1809-
then
1810-
negate=t
1811-
shift
1812-
fi
1813-
1814-
local expr=$(printf '"%s".*' "$@")
1815-
expr="${expr%,}"
1816-
1817-
if test -n "$negate"
1818-
then
1819-
! grep "\"event\":\"child_start\".*\[$expr\]"
1820-
else
1821-
grep "\"event\":\"child_start\".*\[$expr\]"
1822-
fi
1823-
}
1824-
18251791
# Check that the given command was invoked as part of the
18261792
# trace2-format trace on stdin.
18271793
#

0 commit comments

Comments
 (0)