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

Method readdir

src/models/GitWalkerRepo.js:65–87  ·  view source on GitHub ↗
(entry)

Source from the content-addressed store, hash-verified

63 }
64
65 async readdir(entry) {
66 const filepath = entry._fullpath
67 const { fs, cache, gitdir } = this
68 const map = await this.mapPromise
69 const obj = map.get(filepath)
70 if (!obj) throw new Error(`No obj for ${filepath}`)
71 const oid = obj.oid
72 if (!oid) throw new Error(`No oid for obj ${JSON.stringify(obj)}`)
73 if (obj.type !== 'tree') {
74 // TODO: support submodules (type === 'commit')
75 return null
76 }
77 const { type, object } = await readObject({ fs, cache, gitdir, oid })
78 if (type !== obj.type) {
79 throw new ObjectTypeError(oid, type, obj.type)
80 }
81 const tree = GitTree.from(object)
82 // cache all entries
83 for (const entry of tree) {
84 map.set(join(filepath, entry.path), entry)
85 }
86 return tree.entries().map(entry => join(filepath, entry.path))
87 }
88
89 async type(entry) {
90 if (entry._type === false) {

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected