progress
This commit is contained in:
parent
b7c94590f9
commit
f9f9825abb
9 changed files with 941 additions and 42 deletions
|
@ -26,4 +26,16 @@ def _get_current_commit() -> str:
|
|||
"""
|
||||
Returns the current git commit hash, "unknown", or "errored" depending on why the commit could not be retrieved.
|
||||
"""
|
||||
raise NotImplementedError
|
||||
import subprocess
|
||||
try:
|
||||
# Get the current commit hash
|
||||
commit_hash = subprocess.check_output(
|
||||
["git", "rev-parse", "HEAD"], stderr=subprocess.PIPE, text=True
|
||||
).strip()
|
||||
return commit_hash
|
||||
except subprocess.CalledProcessError:
|
||||
# If git command fails (e.g., not a git repository)
|
||||
return "errored"
|
||||
except FileNotFoundError:
|
||||
# If git is not installed
|
||||
return "unknown"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue