mirror of
https://github.com/KhronosGroup/SPIRV-Tools
synced 2024-10-18 11:10:05 +00:00
Check for git repository before git commands (#5403)
When we are attempting to fetch the version info from the git repository, first check if we're actually in one, otherwise spurious errors messages get printed.
This commit is contained in:
parent
361638cfd0
commit
2d6996f731
@ -111,9 +111,11 @@ def describe(repo_path):
|
||||
Runs 'git describe', or alternately 'git rev-parse HEAD', in directory. If
|
||||
successful, returns the output; otherwise returns 'unknown hash, <date>'."""
|
||||
|
||||
success, output = command_output(['git', 'describe'], repo_path)
|
||||
# if we're in a git repository, attempt to extract version info
|
||||
if os.path.exists(".git"):
|
||||
success, output = command_output(["git", "describe"], repo_path)
|
||||
if not success:
|
||||
output = command_output(['git', 'rev-parse', 'HEAD'], repo_path)
|
||||
output = command_output(["git", "rev-parse", "HEAD"], repo_path)
|
||||
|
||||
if success:
|
||||
# decode() is needed here for Python3 compatibility. In Python2,
|
||||
|
Loading…
Reference in New Issue
Block a user