Skip to content

πŸ™Œ OpenHands: AI-Driven Development

fix: remove hardcoded /workspace/project fallbacks from useLocalGitInfo (#671)

Tim O'Farrell9db4683219a9
diff --git a/src/hooks/query/use-local-git-info.ts b/src/hooks/query/use-local-git-info.ts
index 01d02863af..d962eff029 100644
--- a/src/hooks/query/use-local-git-info.ts
+++ b/src/hooks/query/use-local-git-info.ts
@@ -124,19 +124,13 @@ export const useLocalGitInfo = () => {
cwd,
timeout,
);
- const candidateDirs = Array.from(
- new Set([workingDir, "/workspace/project", "workspace/project"]),
- );
-
- for (const candidateDir of candidateDirs) {
- const directInfo = await probeGitInfoAtDir(run, candidateDir);
- if (directInfo.repository || directInfo.branch) return directInfo;
-
- // Common local flow: user starts in a non-git parent workspace and
- // clones a single repository into a child directory.
- const nestedInfo = await probeNestedRepoInDir(run, candidateDir);
- if (nestedInfo.repository || nestedInfo.branch) return nestedInfo;
- }
+ const directInfo = await probeGitInfoAtDir(run, workingDir);
+ if (directInfo.repository || directInfo.branch) return directInfo;
+
+ // Common local flow: user starts in a non-git parent workspace and
+ // clones a single repository into a child directory.
+ const nestedInfo = await probeNestedRepoInDir(run, workingDir);
+ if (nestedInfo.repository || nestedInfo.branch) return nestedInfo;
return EMPTY_LOCAL_GIT_INFO;
},