Unverified 提交 051e9e80 authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

check_git_status() bug fix (#1925)

上级 509dd51a
...@@ -57,7 +57,7 @@ def check_online(): ...@@ -57,7 +57,7 @@ def check_online():
def check_git_status(): 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='') print(colorstr('github: '), end='')
try: try:
if Path('.git').exists() and check_online(): if Path('.git').exists() and check_online():
...@@ -66,13 +66,12 @@ def check_git_status(): ...@@ -66,13 +66,12 @@ def check_git_status():
n = int(subprocess.check_output( n = int(subprocess.check_output(
'git rev-list $(git rev-parse --abbrev-ref HEAD)..origin/master --count', shell=True)) # commits behind 'git rev-list $(git rev-parse --abbrev-ref HEAD)..origin/master --count', shell=True)) # commits behind
if n > 0: if n > 0:
s = f"⚠️ WARNING: code is out of date by {n} {'commits' if n > 1 else 'commmit'}. " \ 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." f"Use 'git pull' to update or 'git clone {url}' to download latest.")
else: else:
s = f'up to date with {url} ✅' print(f'up to date with {url} ✅')
except Exception as e: except Exception as e:
s = str(e) print(e)
print(s)
def check_requirements(file='requirements.txt'): def check_requirements(file='requirements.txt'):
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论