Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions openhands-agent-server/openhands/agent_server/git_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
3 changes: 3 additions & 0 deletions openhands-sdk/openhands/sdk/git/git_changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions openhands-sdk/openhands/sdk/git/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand Down
Loading