Skip to content

Commit 5af50ea

Browse files
fix: add logs for git init failure (#1000)
1 parent 10f7200 commit 5af50ea

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/codegen/git/repo_operator/repo_operator.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,7 @@ def create_from_repo(cls, repo_path: str, url: str, access_token: str | None = N
897897
if local_head.hexsha == remote_head.hexsha:
898898
return cls(repo_config=RepoConfig.from_repo_path(repo_path), bot_commit=False, access_token=access_token)
899899
except Exception:
900-
# If any git operations fail, fallback to fresh clone
901-
pass
900+
logger.exception("Failed to initialize Git repository. Falling back to fresh clone.")
902901

903902
# If we get here, repo exists but is not up to date or valid
904903
# 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
916915
# Initialize with the cloned repo
917916
git_cli = GitCLI(repo_path)
918917
except (GitCommandError, ValueError) as e:
919-
logger.exception("Failed to initialize Git repository:")
920-
logger.exception("Please authenticate with a valid token and ensure the repository is properly initialized.")
918+
logger.exception("Failed to initialize Git repository")
921919
return None
922920
return cls(repo_config=RepoConfig.from_repo_path(repo_path), bot_commit=False, access_token=access_token)

0 commit comments

Comments
 (0)