Update config.py to use fallback git head method

This commit is contained in:
Nick Sweeting 2023-12-18 19:27:52 -08:00 committed by GitHub
parent 5805e18380
commit 487e560e32
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -398,6 +398,13 @@ def get_commit_hash(config) -> Optional[str]:
commit_hash = git_dir.joinpath(ref).read_text().strip() commit_hash = git_dir.joinpath(ref).read_text().strip()
return commit_hash return commit_hash
except Exception: except Exception:
pass
try:
return list((config['PACKAGE_DIR'] / '../.git/refs/heads/').glob('*'))[0].read_text().strip()
except Exception:
pass
return None return None
def get_build_time(config) -> str: def get_build_time(config) -> str: