MCPcopy Create free account
hub / github.com/agegr/pi-web / findRepositoryRoot

Function findRepositoryRoot

lib/git-changes.ts:30–36  ·  view source on GitHub ↗
(cwd: string)

Source from the content-addressed store, hash-verified

28}
29
30async function findRepositoryRoot(cwd: string): Promise<string | null> {
31 try {
32 return (await git(cwd, ["rev-parse", "--show-toplevel"])).trim() || null;
33 } catch {
34 return null;
35 }
36}
37
38function isWithinPath(parent: string, target: string): boolean {
39 const relative = path.relative(path.resolve(parent), path.resolve(target));

Callers 2

getGitStatusFunction · 0.85
getGitFileDiffFunction · 0.85

Calls 1

gitFunction · 0.70

Tested by

no test coverage detected