({ fs, cache, gitdir, oid })
| 5 | import { _readObject } from '../storage/readObject.js' |
| 6 | |
| 7 | export async function resolveTree({ fs, cache, gitdir, oid }) { |
| 8 | // Empty tree - bypass `readObject` |
| 9 | if (oid === '4b825dc642cb6eb9a060e54bf8d69288fbee4904') { |
| 10 | return { tree: GitTree.from([]), oid } |
| 11 | } |
| 12 | const { type, object } = await _readObject({ fs, cache, gitdir, oid }) |
| 13 | // Resolve annotated tag objects to whatever |
| 14 | if (type === 'tag') { |
| 15 | oid = GitAnnotatedTag.from(object).parse().object |
| 16 | return resolveTree({ fs, cache, gitdir, oid }) |
| 17 | } |
| 18 | // Resolve commits to trees |
| 19 | if (type === 'commit') { |
| 20 | oid = GitCommit.from(object).parse().tree |
| 21 | return resolveTree({ fs, cache, gitdir, oid }) |
| 22 | } |
| 23 | if (type !== 'tree') { |
| 24 | throw new ObjectTypeError(oid, type, 'tree') |
| 25 | } |
| 26 | return { tree: GitTree.from(object), oid } |
| 27 | } |
no test coverage detected
searching dependent graphs…