]> git.ipfire.org Git - thirdparty/git.git/commitdiff
build: clang version may not be followed by extra words
authorJeff King <peff@peff.net>
Fri, 6 Aug 2021 19:20:22 +0000 (15:20 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 6 Aug 2021 20:30:24 +0000 (13:30 -0700)
The get_family and get_version helpers of detect-compiler assume
that the line to identify the version from the compilers have a
token "version", followed by the version number, followed by some
other string, e.g.

  $ CC=gcc get_version_line
  gcc version 10.2.1 20210110 (Debian 10.2.1-6)

But that is not necessarily true, e.g.

  $ CC=clang get_version_line
  Debian clang version 11.0.1-2

Tweak the script not to require extra string after the version.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
detect-compiler

index c85be83c6427b34441b6a07b6b4f238efa04635d..955be1c9068f81797daf570747c1d46d638343c9 100755 (executable)
@@ -13,11 +13,11 @@ get_version_line() {
 }
 
 get_family() {
-       get_version_line | sed 's/^\(.*\) version [0-9][^ ]* .*/\1/'
+       get_version_line | sed 's/^\(.*\) version [0-9].*/\1/'
 }
 
 get_version() {
-       get_version_line | sed 's/^.* version \([0-9][^ ]*\) .*/\1/'
+       get_version_line | sed 's/^.* version \([0-9][^ ]*\).*/\1/'
 }
 
 print_flags() {