diff --git a/archivebox/config.py b/archivebox/config.py index 775be8e4..4e434c12 100644 --- a/archivebox/config.py +++ b/archivebox/config.py @@ -393,7 +393,10 @@ def get_version(config): def get_commit_hash(config): 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: return None