MCPcopy Create free account
hub / github.com/bearlyai/OpenADE / resolveWorktreeFilePath

Function resolveWorktreeFilePath

projects/electron/src/modules/code/git.ts:1858–1869  ·  view source on GitHub ↗
(workDir: string, filePath: string)

Source from the content-addressed store, hash-verified

1856}
1857
1858function resolveWorktreeFilePath(workDir: string, filePath: string): { absolutePath: string; relativePath: string } | null {
1859 const resolvedWorkDir = path.resolve(workDir)
1860 const absolutePath = path.resolve(resolvedWorkDir, filePath)
1861 const relativePath = path.relative(resolvedWorkDir, absolutePath)
1862 if (!relativePath || relativePath.startsWith("..") || path.isAbsolute(relativePath)) {
1863 return null
1864 }
1865 return {
1866 absolutePath,
1867 relativePath: relativePath.split(path.sep).join("/"),
1868 }
1869}
1870
1871function finalizeFilePatchResponse(patch: string, allowTruncation: boolean = true): GetFilePatchResponse {
1872 if (!patch) {

Callers 2

getUntrackedFilePatchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected