feat: implement git hash retrieval in __init__.py

This commit is contained in:
Paul Gauthier (aider) 2024-08-30 11:40:11 -07:00
parent aee501d128
commit 8887af5635

View file

@ -2,11 +2,17 @@ __version__ = "0.54.8-dev"
"""
[[[cog
# TODO: write python to emit `git_hash = "X"`, where X is the latest 7-char git hash
# python goes here
import subprocess
try:
git_hash = subprocess.check_output(['git', 'rev-parse', '--short=7', 'HEAD'], universal_newlines=True).strip()
except subprocess.CalledProcessError:
git_hash = ""
print(f'git_hash = "{git_hash}"')
]]]
"""
git_hash = "deadbee"
git_hash = "deadbee" # This line will be replaced by cog
"""
[[[end]]]
"""