({ fs, cache, gitdir, oid, fileId })
| 9 | const EMPTY_OID = 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391' |
| 10 | |
| 11 | export async function resolveFileIdInTree({ fs, cache, gitdir, oid, fileId }) { |
| 12 | if (fileId === EMPTY_OID) return |
| 13 | const _oid = oid |
| 14 | let filepath |
| 15 | const result = await resolveTree({ fs, cache, gitdir, oid }) |
| 16 | const tree = result.tree |
| 17 | if (fileId === result.oid) { |
| 18 | filepath = result.path |
| 19 | } else { |
| 20 | filepath = await _resolveFileId({ |
| 21 | fs, |
| 22 | cache, |
| 23 | gitdir, |
| 24 | tree, |
| 25 | fileId, |
| 26 | oid: _oid, |
| 27 | }) |
| 28 | if (Array.isArray(filepath)) { |
| 29 | if (filepath.length === 0) filepath = undefined |
| 30 | else if (filepath.length === 1) filepath = filepath[0] |
| 31 | } |
| 32 | } |
| 33 | return filepath |
| 34 | } |
| 35 | |
| 36 | async function _resolveFileId({ |
| 37 | fs, |
no test coverage detected
searching dependent graphs…