mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-07-11 10:30:46 -07:00
feat(worktree): add Git worktree support for isolated parallel sessions (#22973)
This commit is contained in:
@@ -48,16 +48,16 @@ export interface ProcessImportsResult {
|
||||
importTree: MemoryFile;
|
||||
}
|
||||
|
||||
// Helper to find the project root (looks for .git directory)
|
||||
// Helper to find the project root (looks for .git directory or file for worktrees)
|
||||
async function findProjectRoot(startDir: string): Promise<string> {
|
||||
let currentDir = path.resolve(startDir);
|
||||
while (true) {
|
||||
const gitPath = path.join(currentDir, '.git');
|
||||
try {
|
||||
const stats = await fs.lstat(gitPath);
|
||||
if (stats.isDirectory()) {
|
||||
return currentDir;
|
||||
}
|
||||
// Check for existence only — .git can be a directory (normal repos)
|
||||
// or a file (submodules / worktrees).
|
||||
await fs.access(gitPath);
|
||||
return currentDir;
|
||||
} catch {
|
||||
// .git not found, continue to parent
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user