Use commit instead of the branch name

This commit is contained in:
Kayou 2020-11-26 16:28:52 +01:00 committed by GitHub
parent 146537dcc1
commit ae7efe820e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -6,7 +6,7 @@ import datetime
import subprocess
def get_current_git_branch():
p = subprocess.Popen("git branch -a --contains | grep remote | cut -d'/' -f3 ", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
p = subprocess.Popen("git rev-parse --verify HEAD", shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout, stderr = p.communicate()
current_branch = stdout.strip().decode('utf-8')