Web lists-archives.com

[PATCH (Apple Git) 04/13] t4014: git --version can have SP in it




480871e09e ("format-patch: show base info before email signature",
2016-09-07) added a helper function to recreate the signature at the end
of the e-mail, i.e. "-- " line followed by the version string of Git,
using output from "git --version" and stripping everything before the last
SP.

Because the default Git version string looks like "git version
2.10.0-1-g480871e09e", this was mostly OK, but people can change this
version string to arbitrary thing while compiling, which can break the
assumption if they had SP in it.  Notably, Apple ships modified Git with
" (Apple Git-xx)" appended to its version number.

Instead, come up with the version string by stripping the "git version "
from the beginning.

Regressed-in: 480871e09ed2e5275b4ba16b278681e5a8c122ae
Signed-off-by: Jeremy Huddleston Sequoia <jeremyhu@xxxxxxxxx>
Reviewed-by: Josh Triplett <josh@xxxxxxxxxxxxxxxx>
---
 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 909c743c13..414c56fcff 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -757,7 +757,7 @@ test_expect_success 'format-patch --ignore-if-in-upstream HEAD' '
 	git format-patch --ignore-if-in-upstream HEAD
 '
 
-git_version="$(git --version | sed "s/.* //")"
+git_version="$(git --version | sed "s/git version //")"
 
 signature() {
 	printf "%s\n%s\n\n" "-- " "${1:-$git_version}"
-- 
2.20.0 (Apple Git-115)