diff --git a/openhands-agent-server/openhands/agent_server/git_router.py b/openhands-agent-server/openhands/agent_server/git_router.py index 5437580710..84a3a9c653 100644 --- a/openhands-agent-server/openhands/agent_server/git_router.py +++ b/openhands-agent-server/openhands/agent_server/git_router.py @@ -20,6 +20,7 @@ async def git_changes( path: Path, ) -> list[GitChange]: + logger.info(f"Received request for git changes in path: {path}") update_last_execution_time() loop = asyncio.get_running_loop() changes = await loop.run_in_executor(None, get_git_changes, path) @@ -30,6 +31,7 @@ async def git_changes( async def git_diff( path: Path, ) -> GitDiff: + logger.info(f"Received request for git diff in path: {path}") update_last_execution_time() loop = asyncio.get_running_loop() changes = await loop.run_in_executor(None, get_git_diff, path) diff --git a/openhands-sdk/openhands/sdk/git/git_changes.py b/openhands-sdk/openhands/sdk/git/git_changes.py index 2959546c4d..fa7f2c725b 100644 --- a/openhands-sdk/openhands/sdk/git/git_changes.py +++ b/openhands-sdk/openhands/sdk/git/git_changes.py @@ -196,10 +196,12 @@ def get_changes_in_repo(repo_dir: str | Path) -> list[GitChange]: def get_git_changes(cwd: str | Path) -> list[GitChange]: + logger.info(f"get_git_changes: Looking in directory {cwd}") git_dirs = { os.path.dirname(f)[2:] for f in glob.glob("./*/.git", root_dir=cwd, recursive=True) } + logger.info(f"get_git_changes: Found git directories: {git_dirs} in {cwd}") # First try the workspace directory changes = get_changes_in_repo(cwd) @@ -219,6 +221,7 @@ def get_git_changes(cwd: str | Path) -> list[GitChange]: # Add changes from git directories for git_dir in git_dirs: + logger.info(f"get_git_changes: getting changes for {git_dir} in {cwd}") git_dir_changes = get_changes_in_repo(str(Path(cwd, git_dir))) for change in git_dir_changes: # Create a new GitChange with the updated path diff --git a/openhands-sdk/openhands/sdk/git/utils.py b/openhands-sdk/openhands/sdk/git/utils.py index bc5bebf610..f6c40bfd80 100644 --- a/openhands-sdk/openhands/sdk/git/utils.py +++ b/openhands-sdk/openhands/sdk/git/utils.py @@ -200,7 +200,9 @@ def validate_git_repository(repo_dir: str | Path) -> Path: Raises: GitRepositoryError: If not a valid git repository """ + logger.info(f"Validating git repository at: {repo_dir}") repo_path = Path(repo_dir).resolve() + logger.info(f"Resolved repository path: {repo_path}") if not repo_path.exists(): raise GitRepositoryError(f"Directory does not exist: {repo_path}")