bencher.git_info ================ .. py:module:: bencher.git_info .. autoapi-nested-parse:: Git metadata helpers for benchmark time tracking. Functions --------- .. autoapisummary:: bencher.git_info._run_git bencher.git_info.git_time_event Module Contents --------------- .. py:function:: _run_git(args: list[str], repo_path: str | None = None) -> str Run a git subcommand and return its stripped stdout, or empty string on failure. .. py:function:: git_time_event(repo_path: str | None = None) -> str Return a time-event label combining wall-clock time and short commit hash. Example return value: ``"2024-06-15 14:59 abc1234"`` The SHA portion is git's canonical abbreviated hash (``rev-parse --short``), which is typically 7 characters but may be longer in large repositories to avoid ambiguity. Intended to be used with ``BenchRunCfg(over_time=True, time_event=...)`` so the over-time slider shows *when* and *which commit* produced the data. Wall-clock time is used instead of commit time so that multiple benchmark runs on the same commit produce distinct labels. For fork-safety in multithreaded environments (ROS 2, DDS, etc.), call this at module level before starting background threads:: _TIME_EVENT = bn.git_time_event() # safe: no threads yet Falls back to ``" unknown"`` if not inside a git repository or git is unavailable, keeping the label format consistent.