]> Kevux Git Server - rit/commitdiff
t4014: support Git version strings with spaces
authorRené Scharfe <l.s.r@web.de>
Sat, 13 Dec 2025 09:40:42 +0000 (10:40 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 14 Dec 2025 06:50:44 +0000 (15:50 +0900)
git --version reports its version with the prefix "git version ".
Remove precisely this string instead of everything up to and including
the rightmost 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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t4014-format-patch.sh

index 2782b1f..21d6d0c 100755 (executable)
@@ -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() {