Unverified 提交 3b7feeaf authored 作者: Glenn Jocher's avatar Glenn Jocher 提交者: GitHub

Update general.py check_git_status() fix (#2020)

上级 aac33f87
...@@ -65,9 +65,9 @@ def check_git_status(): ...@@ -65,9 +65,9 @@ def check_git_status():
assert not Path('/workspace').exists(), 'skipping check (Docker image)' # not Path('/.dockerenv').exists() assert not Path('/workspace').exists(), 'skipping check (Docker image)' # not Path('/.dockerenv').exists()
assert check_online(), 'skipping check (offline)' assert check_online(), 'skipping check (offline)'
cmd = 'git fetch && git config --get remote.origin.url' # github repo url cmd = 'git fetch && git config --get remote.origin.url'
url = subprocess.check_output(cmd, shell=True).decode().rstrip() url = subprocess.check_output(cmd, shell=True).decode().strip().rstrip('.git') # github repo url
branch = subprocess.check_output('git branch --show-current', shell=True).decode().rstrip() # current 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 n = int(subprocess.check_output(f'git rev-list {branch}..origin/master --count', shell=True)) # commits behind
if n > 0: if n > 0:
s = f"⚠️ WARNING: code is out of date by {n} commit{'s' * (n > 1)}. " \ s = f"⚠️ WARNING: code is out of date by {n} commit{'s' * (n > 1)}. " \
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论