mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-14 05:42:54 -07:00
fix(cli): ensure branch indicator updates in sub-directories and worktrees (#26330)
This commit is contained in:
@@ -6,6 +6,18 @@
|
||||
|
||||
import * as fs from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import { spawnAsync } from './shell-utils.js';
|
||||
|
||||
/**
|
||||
* Gets the absolute path to the git directory (.git) for the given working directory.
|
||||
* This handles standard git repositories, subdirectories, and worktrees.
|
||||
*/
|
||||
export async function getAbsoluteGitDir(cwd: string): Promise<string> {
|
||||
const result = await spawnAsync('git', ['rev-parse', '--absolute-git-dir'], {
|
||||
cwd,
|
||||
});
|
||||
return result.stdout.trim();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a directory is within a git repository
|
||||
|
||||
Reference in New Issue
Block a user