ui improvements on error when registering repos

This commit is contained in:
2026-04-26 18:27:19 +02:00
parent 2c0213717c
commit dda00b70ac
4 changed files with 109 additions and 18 deletions

View File

@@ -63,14 +63,20 @@ class GitIngestionService:
def _run_git(self, args: list[str], *, cwd: Path | None) -> None:
if shutil.which("git") is None:
raise RuntimeError("git executable was not found")
result = subprocess.run(
["git", *args],
cwd=cwd,
check=False,
capture_output=True,
text=True,
timeout=120,
)
command = ["git", *args]
try:
result = subprocess.run(
command,
cwd=cwd,
check=False,
capture_output=True,
text=True,
timeout=120,
)
except subprocess.TimeoutExpired as exc:
raise RuntimeError(
f"git {' '.join(args)} timed out after {exc.timeout} seconds"
) from exc
if result.returncode != 0:
message = result.stderr.strip() or result.stdout.strip()
raise RuntimeError(f"git {' '.join(args)} failed: {message}")