({
fs,
cache,
gitdir,
tree,
fileId,
oid,
filepaths = [],
parentPath = '',
})
| 34 | } |
| 35 | |
| 36 | async 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 | } |
no test coverage detected
searching dependent graphs…