git(core): include cwd and git output in pull_args error

Show the working directory and captured git output when `git pull`
fails via pull_args(). This makes debugging repository-specific
failures (missing upstream, auth issues, detached HEAD, etc.)
significantly easier, especially when pulling multiple repositories.

https://chatgpt.com/share/6969ff2c-ed2c-800f-b506-5834b6b81141
This commit is contained in:
2026-01-16 10:04:40 +01:00
parent 25a0579809
commit cc1e543ebc

View File

@@ -29,7 +29,11 @@ def pull_args(
try: try:
run(["pull", *extra], cwd=cwd, preview=preview) run(["pull", *extra], cwd=cwd, preview=preview)
except GitRunError as exc: except GitRunError as exc:
details = getattr(exc, "output", None) or getattr(exc, "stderr", None) or ""
raise GitPullArgsError( raise GitPullArgsError(
f"Failed to run `git pull` with args={extra!r}.", (
f"Failed to run `git pull` with args={extra!r} "
f"in cwd={cwd!r}.\n{details}"
).rstrip(),
cwd=cwd, cwd=cwd,
) from exc ) from exc