MCPcopy Create free account
hub / github.com/isomorphic-git/isomorphic-git / _resolveFilepath

Function _resolveFilepath

src/utils/resolveFilepath.js:39–77  ·  view source on GitHub ↗
({
  fs,
  cache,
  gitdir,
  tree,
  pathArray,
  oid,
  filepath,
})

Source from the content-addressed store, hash-verified

37}
38
39async function _resolveFilepath({
40 fs,
41 cache,
42 gitdir,
43 tree,
44 pathArray,
45 oid,
46 filepath,
47}) {
48 const name = pathArray.shift()
49 for (const entry of tree) {
50 if (entry.path === name) {
51 if (pathArray.length === 0) {
52 return entry.oid
53 } else {
54 const { type, object } = await readObject({
55 fs,
56 cache,
57 gitdir,
58 oid: entry.oid,
59 })
60 if (type !== 'tree') {
61 throw new ObjectTypeError(oid, type, 'tree', filepath)
62 }
63 tree = GitTree.from(object)
64 return _resolveFilepath({
65 fs,
66 cache,
67 gitdir,
68 tree,
69 pathArray,
70 oid,
71 filepath,
72 })
73 }
74 }
75 }
76 throw new NotFoundError(`file or directory found at "${oid}:${filepath}"`)
77}

Callers 1

resolveFilepathFunction · 0.85

Calls 2

readObjectFunction · 0.85
fromMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…