MCPcopy Create free account
hub / github.com/MoonshotAI/kimi-code / readBranch

Function readBranch

apps/kimi-code/src/utils/git/git-status.ts:158–170  ·  view source on GitHub ↗
(workDir: string)

Source from the content-addressed store, hash-verified

156}
157
158function readBranch(workDir: string): string | null {
159 try {
160 const result = spawnSync('git', ['-C', workDir, 'branch', '--show-current'], {
161 encoding: 'utf8',
162 timeout: SPAWN_TIMEOUT_MS,
163 });
164 if (result.status !== 0) return null;
165 const name = result.stdout.trim();
166 return name.length > 0 ? name : null;
167 } catch {
168 return null;
169 }
170}
171
172function readStatus(workDir: string): {
173 dirty: boolean;

Callers 1

createGitStatusCacheFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected