({
fs,
cache,
gitdir,
tree,
pathArray,
oid,
filepath,
})
| 37 | } |
| 38 | |
| 39 | async 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 | } |
no test coverage detected
searching dependent graphs…