debug(git_helper): retry clone without progress to capture git stderr

When git clone with progress=GitProgress() fails on Windows, the tqdm
progress callback consumes stderr, hiding git's actual fatal message.

This adds a diagnostic retry: on clone failure, if e.stderr is empty,
clean up the partial clone and retry without progress callback. The
retry either succeeds (proving progress was the issue) or fails with
git's actual stderr visible.

Also captures stderr in run_script() via subprocess.run(capture_output=True).

NOTE: This is a diagnostic commit — revert after root cause is identified.
This commit is contained in:
Dr.Lt.Data 2026-03-21 16:49:00 +09:00
parent 324851f146
commit 8fd463b8cd

View File

@ -101,13 +101,30 @@ 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
# First attempt with progress display; on failure retry without progress
# so git's stderr (fatal message) is not consumed by the progress callback.
try:
repo = git.Repo.clone_from(url, repo_path, recursive=True, progress=GitProgress())
except git.GitCommandError as e:
stderr_msg = e.stderr or ''
print(f"git clone failed for '{url}': {e}", file=sys.stderr)
if e.stderr:
print(e.stderr, file=sys.stderr)
raise
if stderr_msg:
print(f"git stderr: {stderr_msg}", file=sys.stderr)
else:
# Retry without progress to capture git's actual stderr
import shutil
if os.path.exists(repo_path):
shutil.rmtree(repo_path, ignore_errors=True)
try:
repo = git.Repo.clone_from(url, repo_path, recursive=True)
except git.GitCommandError as e2:
print(f"git clone retry failed: {e2}", file=sys.stderr)
if e2.stderr:
print(f"git stderr: {e2.stderr}", file=sys.stderr)
raise e2
# If retry succeeds, the first failure was progress-related
print("git clone succeeded without progress callback", file=sys.stderr)
return
if target_hash is not None:
print(f"CHECKOUT: {repo_name} [{target_hash}]")