git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] t4014: support Git version strings with spaces

From
René Scharfe <l.s.r@web.de>
Date
Dec 13, 2025, 09:40 UTC
Message-ID
<b79cba1d-f32b-4034-979e-fb9528d05f18@web.de>
In-Reply-To
<eb0e6533-44ef-4b85-b1aa-f43f6d4174a4@web.de>

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>
---
Changes since v1:
- fix description of current removal pattern in commit message
 t/t4014-format-patch.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
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
Previous: René Scharfe
Message 4 of 4 in “t4014: support Git version strings with spaces”
  1. t4014: support Git version strings with spacesRené Scharfe, Dec 13, 2025
  2. Junio C HamanoDec 13, 2025
  3. René ScharfeDec 13, 2025
  4. t4014: support Git version strings with spacesRené Scharfe, Dec 13, 2025

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.