Skip to content

Commit

Permalink
check_git_status() bug fix (ultralytics#1925)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Jan 13, 2021
1 parent 57c4a46 commit 58168f1
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def check_online():


def check_git_status():
# Suggest 'git pull' if YOLOv5 is out of date
# Recommend 'git pull' if code is out of date
print(colorstr('github: '), end='')
try:
if Path('.git').exists() and check_online():
Expand All @@ -66,13 +66,12 @@ def check_git_status():
n = int(subprocess.check_output(
'git rev-list $(git rev-parse --abbrev-ref HEAD)..origin/master --count', shell=True)) # commits behind
if n > 0:
s = f"⚠️ WARNING: code is out of date by {n} {'commits' if n > 1 else 'commmit'}. " \
f"Use 'git pull' to update or 'git clone {url}' to download latest."
print(f"⚠️ WARNING: code is out of date by {n} {'commits' if n > 1 else 'commmit'}. "
f"Use 'git pull' to update or 'git clone {url}' to download latest.")
else:
s = f'up to date with {url} ✅'
print(f'up to date with {url} ✅')
except Exception as e:
s = str(e)
print(s)
print(e)


def check_requirements(file='requirements.txt'):
Expand Down

0 comments on commit 58168f1

Please sign in to comment.