From 95f9c5e95c55b7626c4113e08f9dcffee048aa08 Mon Sep 17 00:00:00 2001 From: Christine Wang Date: Tue, 1 Apr 2025 13:54:03 -0700 Subject: [PATCH] fix: add logs for git init failure --- src/codegen/git/repo_operator/repo_operator.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/codegen/git/repo_operator/repo_operator.py b/src/codegen/git/repo_operator/repo_operator.py index edee45a18..f3bf2776f 100644 --- a/src/codegen/git/repo_operator/repo_operator.py +++ b/src/codegen/git/repo_operator/repo_operator.py @@ -897,8 +897,7 @@ def create_from_repo(cls, repo_path: str, url: str, access_token: str | None = N if local_head.hexsha == remote_head.hexsha: return cls(repo_config=RepoConfig.from_repo_path(repo_path), bot_commit=False, access_token=access_token) except Exception: - # If any git operations fail, fallback to fresh clone - pass + logger.exception("Failed to initialize Git repository. Falling back to fresh clone.") # If we get here, repo exists but is not up to date or valid # Remove the existing directory to do a fresh clone @@ -916,7 +915,6 @@ def create_from_repo(cls, repo_path: str, url: str, access_token: str | None = N # Initialize with the cloned repo git_cli = GitCLI(repo_path) except (GitCommandError, ValueError) as e: - logger.exception("Failed to initialize Git repository:") - logger.exception("Please authenticate with a valid token and ensure the repository is properly initialized.") + logger.exception("Failed to initialize Git repository") return None return cls(repo_config=RepoConfig.from_repo_path(repo_path), bot_commit=False, access_token=access_token)