Handle errors from git describe
The git describe command reports errors if there are no tags to be used to get a description. Trap the errors in places where it is reasonable to encounter that situation. Change-Id: I436af248b1740c493b14178cbbe59c8b0474aa94
This commit is contained in:
@@ -161,9 +161,12 @@ def main():
|
||||
# Show more details about the commit being tagged.
|
||||
print()
|
||||
print('git describe %s' % project['hash'])
|
||||
subprocess.call(
|
||||
['git', 'describe', project['hash']],
|
||||
cwd=os.path.join(workdir, project['repo']),
|
||||
)
|
||||
try:
|
||||
subprocess.check_call(
|
||||
['git', 'describe', project['hash']],
|
||||
cwd=os.path.join(workdir, project['repo']),
|
||||
)
|
||||
except subprocess.CalledProcessError as e:
|
||||
print('WARNING: Could not run git describe: %s' % e)
|
||||
|
||||
return 0
|
||||
|
||||
@@ -90,7 +90,10 @@ def check_ancestry(workdir, repo, old_version, sha):
|
||||
|
||||
|
||||
def get_latest_tag(workdir, repo):
|
||||
return subprocess.check_output(
|
||||
['git', 'describe', '--abbrev=0'],
|
||||
cwd=os.path.join(workdir, repo),
|
||||
).strip()
|
||||
try:
|
||||
return subprocess.check_output(
|
||||
['git', 'describe', '--abbrev=0'],
|
||||
cwd=os.path.join(workdir, repo),
|
||||
).strip()
|
||||
except subprocess.CalledProcessError:
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user