Skip to content

Commit

Permalink
Update general.py check_git_status() fix (ultralytics#2020)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher committed Jan 22, 2021
1 parent bb0b89f commit 86565c4
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ def check_git_status():
assert not Path('/workspace').exists(), 'skipping check (Docker image)' # not Path('/.dockerenv').exists()
assert check_online(), 'skipping check (offline)'

cmd = 'git fetch && git config --get remote.origin.url' # github repo url
url = subprocess.check_output(cmd, shell=True).decode().rstrip()
branch = subprocess.check_output('git branch --show-current', shell=True).decode().rstrip() # current
cmd = 'git fetch && git config --get remote.origin.url'
url = subprocess.check_output(cmd, shell=True).decode().strip().rstrip('.git') # github repo url
branch = subprocess.check_output('git rev-parse --abbrev-ref HEAD', shell=True).decode().strip() # checked out
n = int(subprocess.check_output(f'git rev-list {branch}..origin/master --count', shell=True)) # commits behind
if n > 0:
s = f"⚠️ WARNING: code is out of date by {n} commit{'s' * (n > 1)}. " \
Expand Down

0 comments on commit 86565c4

Please sign in to comment.