MCPcopy Index your code
hub / github.com/Noumena-Network/code / getFileStatus

Function getFileStatus

src/utils/git.ts:404–432  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

402}
403
404export const getFileStatus = async (): Promise<GitFileStatus> => {
405 const { stdout } = await execFileNoThrow(
406 gitExe(),
407 ['--no-optional-locks', 'status', '--porcelain'],
408 {
409 preserveOutputOnError: false,
410 },
411 )
412
413 const tracked: string[] = []
414 const untracked: string[] = []
415
416 stdout
417 .trim()
418 .split('\n')
419 .filter(line => line.length > 0)
420 .forEach(line => {
421 const status = line.substring(0, 2)
422 const filename = line.substring(2).trim()
423
424 if (status === '??') {
425 untracked.push(filename)
426 } else if (filename) {
427 tracked.push(filename)
428 }
429 })
430
431 return { tracked, untracked }
432}
433
434export const getWorktreeCount = async (): Promise<number> => {
435 return getWorktreeCountFromFs()

Callers 2

loadChangedFilesFunction · 0.85
stashToCleanStateFunction · 0.85

Calls 1

execFileNoThrowFunction · 0.70

Tested by

no test coverage detected