From: Derrick Stolee via GitGitGadget Date: Tue, 06 Apr 2021 18:47:47 GMT Subject: [PATCH v2 2/5] test-lib: use exact match for test_subcommand Message-ID: In-Reply-To: From: Derrick Stolee The use of 'grep' inside test_subcommand uses general patterns, leading to sometimes needing escape characters to avoid incorrect matches. Further, some platforms interpret regular expression metacharacters differently. Furthermore, it can be difficult to know which characters need escaping since the actual regular expression language implemented by various `grep`s differs between platforms; for instance, some may employ pure BRE, whereas others a mix of BRE & ERE. Sidestep this difficulty by using `grep -F` to use an exact match. This requires removing escape characters from existing callers. Luckily, this is only one test that expects refspecs as part of the subcommand. Helped-by: Eric Sunshine Signed-off-by: Derrick Stolee --- t/t7900-maintenance.sh | 4 ++-- t/test-lib-functions.sh | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/t/t7900-maintenance.sh b/t/t7900-maintenance.sh index 2412d8c5c006..37eed6ed3aa3 100755 --- a/t/t7900-maintenance.sh +++ b/t/t7900-maintenance.sh @@ -142,8 +142,8 @@ test_expect_success 'prefetch multiple remotes' ' test_commit -C clone2 two && GIT_TRACE2_EVENT="$(pwd)/run-prefetch.txt" git maintenance run --task=prefetch 2>/dev/null && fetchargs="--prune --no-tags --no-write-fetch-head --recurse-submodules=no --refmap= --quiet" && - test_subcommand git fetch remote1 $fetchargs +refs/heads/\\*:refs/prefetch/remote1/\\*