mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-24 02:27:52 -06:00
refactor: share the probe commit reader
packprobe.git_head reads HEAD through core_probe.head_commit, the reader frontend_identity uses, and warns when git cannot answer instead of recording None silently.
This commit is contained in:
1 parent
872ffc7cc6
commit
6f510be49a
3 files changed
+32
-6
No files matched your search
@@ -671,14 +671,20 @@ def host_identity() -> dict:
|
||||
}
|
||||
|
||||
|
||||
def head_commit(root: Path = ROOT) -> str:
|
||||
"""The commit checked out at *root*. Raises OSError or CalledProcessError
|
||||
when git cannot say: each caller decides what a record holds then."""
|
||||
return subprocess.run(["git", "rev-parse", "HEAD"], cwd=root, capture_output=True,
|
||||
text=True, check=True).stdout.strip()
|
||||
|
||||
|
||||
def frontend_identity(script: Path = SCRIPT_PATH,
|
||||
label: str = "scripts/core_probe.py") -> dict:
|
||||
"""The commit a measurement came from, and whether its script differs from it."""
|
||||
commit: str | None = None
|
||||
dirty: bool | None = None
|
||||
try:
|
||||
commit = subprocess.run(["git", "rev-parse", "HEAD"], cwd=ROOT, capture_output=True,
|
||||
text=True, check=True).stdout.strip()
|
||||
commit = head_commit()
|
||||
status = subprocess.run(["git", "status", "--porcelain", "--", str(script)], cwd=ROOT,
|
||||
capture_output=True, text=True, check=True).stdout
|
||||
dirty = bool(status.strip())
|
||||
|
||||
Reference in new issue
Block a user