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

Function _resolveFileId

src/utils/resolveFileIdInTree.js:36–75  ·  view source on GitHub ↗
({
  fs,
  cache,
  gitdir,
  tree,
  fileId,
  oid,
  filepaths = [],
  parentPath = '',
})

Source from the content-addressed store, hash-verified

34}
35
36async function _resolveFileId({
37 fs,
38 cache,
39 gitdir,
40 tree,
41 fileId,
42 oid,
43 filepaths = [],
44 parentPath = '',
45}) {
46 const walks = tree.entries().map(function (entry) {
47 let result
48 if (entry.oid === fileId) {
49 result = join(parentPath, entry.path)
50 filepaths.push(result)
51 } else if (entry.type === 'tree') {
52 result = readObject({
53 fs,
54 cache,
55 gitdir,
56 oid: entry.oid,
57 }).then(function ({ object }) {
58 return _resolveFileId({
59 fs,
60 cache,
61 gitdir,
62 tree: GitTree.from(object),
63 fileId,
64 oid,
65 filepaths,
66 parentPath: join(parentPath, entry.path),
67 })
68 })
69 }
70 return result
71 })
72
73 await Promise.all(walks)
74 return filepaths
75}

Callers 1

resolveFileIdInTreeFunction · 0.85

Calls 4

joinFunction · 0.90
readObjectFunction · 0.85
entriesMethod · 0.45
fromMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…