summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/fetch_strategy.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py
index f885980ccd..da0b12556f 100644
--- a/lib/spack/spack/fetch_strategy.py
+++ b/lib/spack/spack/fetch_strategy.py
@@ -780,8 +780,9 @@ class GitFetchStrategy(VCSFetchStrategy):
@property
def git_version(self):
- vstring = self.git('--version', output=str).lstrip('git version ')
- return Version(vstring)
+ output = self.git('--version', output=str, error=str)
+ match = re.search(r'git version (\S+)', output)
+ return Version(match.group(1)) if match else None
@property
def git(self):