Skip to content

Commit

Permalink
Update git_describe() (#7402)
Browse files Browse the repository at this point in the history
* Update `git_describe()`

Add .git path check to avoid `fatal: not a git repository (or any of the parent directories): .git` printout

* Update general.py
  • Loading branch information
glenn-jocher committed Apr 12, 2022
1 parent 2da2466 commit 014acde
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ def check_online():
def git_describe(path=ROOT): # path must be a directory
# Return human-readable git description, i.e. v5.0-5-g3e25f1e https://git-scm.com/docs/git-describe
try:
assert (Path(path) / '.git').is_dir()
return check_output(f'git -C {path} describe --tags --long --always', shell=True).decode()[:-1]
except Exception:
return ''
Expand Down

0 comments on commit 014acde

Please sign in to comment.