git --version reports its version with the prefix "git version ". Remove precisely this string instead of everything up to and including the first space to avoid butchering version strings that contain spaces. This helps Apple's release of Git, which reports its version like this: "git version 2.50.1 (Apple Git-155)".
Signed-off-by: René Scharfe <l.s.r@web.de> --- Not an Apple patch. They use sed(1) instead, which inadvertently hides the return code of git:
https://github.com/apple-oss-distributions/Git/blob/6b2f9bfe72d6d4b5c9bcc1c2d0236c026d321cba/src/git/t/t4014-format-patch.sh#L982
t/t4014-format-patch.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Show changes to t/t4014-format-patch.sh +1 −1
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh index 2782b1fc18..21d6d0cd9e 100755 --- a/t/t4014-format-patch.sh +++ b/t/t4014-format-patch.sh @@ -980,7 +980,7 @@ test_expect_success 'format-patch --ignore-if-in-upstream HEAD' ' test_expect_success 'get git version' ' git_version=$(git --version) && - git_version=${git_version##* } + git_version=${git_version#git version } ' signature() {
-- 2.52.0