diff --git a/scripts/hooks/check_adr_cross_ref.py b/scripts/hooks/check_adr_cross_ref.py index 38bcabb2..c97d6c09 100644 --- a/scripts/hooks/check_adr_cross_ref.py +++ b/scripts/hooks/check_adr_cross_ref.py @@ -21,8 +21,14 @@ def _run_git(*args: str) -> tuple[int, str]: - result = subprocess.run(["git", *args], capture_output=True, text=True) - return result.returncode, result.stdout + try: + result = subprocess.run( + ["git", *args], capture_output=True, text=True, timeout=15 + ) + return result.returncode, result.stdout + except subprocess.TimeoutExpired: + print("ERROR: git command timed out", file=sys.stderr) + sys.exit(1) def _get_staged_content(path: str) -> str | None: