Fix git_version on macOS (#24163)

This commit is contained in:
Adam J. Stewart 2021-06-05 18:30:28 -05:00 committed by GitHub
parent 9f8e40e95c
commit 7449d6950a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -780,8 +780,9 @@ def __init__(self, **kwargs):
@property @property
def git_version(self): def git_version(self):
vstring = self.git('--version', output=str).lstrip('git version ') output = self.git('--version', output=str, error=str)
return Version(vstring) match = re.search(r'git version (\S+)', output)
return Version(match.group(1)) if match else None
@property @property
def git(self): def git(self):