Update system-info.py

`git branch --show-current` only works for Git 2.22 or above. Using
`git rev-parse --abbrev-ref HEAD` enables older versions(1.7+) of Git to function properly
pull/21/head
Vesnica 2023-06-17 17:15:36 +08:00 committed by GitHub
parent acfc8d68b8
commit 4bc32b760d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -275,7 +275,7 @@ def get_version():
githash, updated = ver.split(' ')
res = subprocess.run('git remote get-url origin', stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell=True, check=True)
origin = res.stdout.decode(encoding = 'utf8', errors='ignore') if len(res.stdout) > 0 else ''
res = subprocess.run('git branch --show-current', stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell=True, check=True)
res = subprocess.run('git rev-parse --abbrev-ref HEAD', stdout = subprocess.PIPE, stderr = subprocess.PIPE, shell=True, check=True)
branch = res.stdout.decode(encoding = 'utf8', errors='ignore') if len(res.stdout) > 0 else ''
version = {
'updated': updated,