1
0
Fork 0

make get_commit_hash more precisce by using exact ref

This commit is contained in:
Nick Sweeting 2023-03-28 02:58:49 -06:00
parent f6ea21eabf
commit 0b950b3253

View file

@ -393,7 +393,10 @@ def get_version(config):
def get_commit_hash(config): def get_commit_hash(config):
try: try:
return list((config['PACKAGE_DIR'] / '../.git/refs/heads/').glob('*'))[0].read_text().strip() git_dir = config['PACKAGE_DIR'] / '../')
ref = (git_dir / 'HEAD').read_text().strip().split(' ')[-1]
commit_hash = git_dir.joinpath(ref).read_text().strip()
return commit_hash
except Exception: except Exception:
return None return None