git branch

This commit is contained in:
Dun Liang 2020-03-26 22:58:28 +08:00
parent d148f4539b
commit fd9867ebb9
1 changed files with 4 additions and 1 deletions

View File

@ -150,7 +150,10 @@ def find_cache_path():
cache_name = os.environ["cache_name"]
else:
# try to get branch name from git
bs = run_cmd("git branch 2>&1", os.path.dirname(__file__)).splitlines()
r = sp.run("git branch", cwd=os.path.dirname(__file__), stdout=sp.PIPE,
stderr=sp.PIPE)
assert r.returncode == 0
bs = r.stdout.decode()
for b in bs:
if b.startswith("* "): break
cache_name = b[2:]