fix(git_helper): surface git stderr on clone failure for diagnostics

When git clone fails with exit 128 on Windows, the actual git error
(e.g. "fatal: destination path already exists") is hidden inside
GitPython's GitCommandError.stderr. Catch this specifically in
gitclone() and print e.stderr to sys.stderr before re-raising, so
the actual cause is visible in CI logs and parent process output.

No behavioral change — progress=GitProgress() is preserved as-is.
This commit is contained in:
Dr.Lt.Data 2026-03-21 10:18:50 +09:00
parent 099aed1ad4
commit 58debee9cf

View File

@ -101,7 +101,13 @@ def gitclone(custom_nodes_path, url, target_hash=None, repo_path=None):
repo_path = os.path.join(custom_nodes_path, repo_name)
# Clone the repository from the remote URL
repo = git.Repo.clone_from(url, repo_path, recursive=True, progress=GitProgress())
try:
repo = git.Repo.clone_from(url, repo_path, recursive=True, progress=GitProgress())
except git.GitCommandError as e:
print(f"git clone failed for '{url}': {e}", file=sys.stderr)
if e.stderr:
print(e.stderr, file=sys.stderr)
raise
if target_hash is not None:
print(f"CHECKOUT: {repo_name} [{target_hash}]")