From 487e560e321c595a2e3f428e3665acf00e0a0aac Mon Sep 17 00:00:00 2001 From: Nick Sweeting Date: Mon, 18 Dec 2023 19:27:52 -0800 Subject: [PATCH] Update config.py to use fallback git head method --- archivebox/config.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/archivebox/config.py b/archivebox/config.py index 90186b1c..1716036f 100644 --- a/archivebox/config.py +++ b/archivebox/config.py @@ -398,7 +398,14 @@ def get_commit_hash(config) -> Optional[str]: commit_hash = git_dir.joinpath(ref).read_text().strip() return commit_hash except Exception: - return None + pass + + try: + return list((config['PACKAGE_DIR'] / '../.git/refs/heads/').glob('*'))[0].read_text().strip() + except Exception: + pass + + return None def get_build_time(config) -> str: if config['IN_DOCKER']: