Skip to content

Commit

Permalink
Update git_describe() for remote dir usage (ultralytics#2606)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Mar 26, 2021
1 parent 046e248 commit 2ecff08
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions utils/torch_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ def init_torch_seeds(seed=0):

def git_describe():
# return human-readable git description, i.e. v5.0-5-g3e25f1e https://git-scm.com/docs/git-describe
if Path('.git').exists():
return subprocess.check_output('git describe --tags --long --always', shell=True).decode('utf-8')[:-1]
else:
s = f'git -C {Path(__file__).resolve().parent} describe --tags --long --always'
try:
return subprocess.check_output(s, shell=True).decode()[:-1]
except subprocess.CalledProcessError as e:
return ''


Expand Down

0 comments on commit 2ecff08

Please sign in to comment.