From 3b7feeafdffbf1dd955b565c31901f3055ab48a6 Mon Sep 17 00:00:00 2001 From: Glenn Jocher Date: Fri, 22 Jan 2021 15:59:01 -0800 Subject: [PATCH] Update general.py check_git_status() fix (#2020) --- utils/general.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utils/general.py b/utils/general.py index 8421ba0c7ea7..27cefe58a045 100755 --- a/utils/general.py +++ b/utils/general.py @@ -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)}. " \