MCPcopy Index your code
hub / github.com/isomorphic-git/isomorphic-git / constructTree

Function constructTree

src/commands/commit.js:186–210  ·  view source on GitHub ↗
({ fs, gitdir, inode, dryRun })

Source from the content-addressed store, hash-verified

184}
185
186async function constructTree({ fs, gitdir, inode, dryRun }) {
187 // use depth first traversal
188 const children = inode.children
189 for (const inode of children) {
190 if (inode.type === 'tree') {
191 inode.metadata.mode = '040000'
192 inode.metadata.oid = await constructTree({ fs, gitdir, inode, dryRun })
193 }
194 }
195 const entries = children.map(inode => ({
196 mode: inode.metadata.mode,
197 path: inode.basename,
198 oid: inode.metadata.oid,
199 type: inode.type,
200 }))
201 const tree = GitTree.from(entries)
202 const oid = await writeObject({
203 fs,
204 gitdir,
205 type: 'tree',
206 object: tree.toObject(),
207 dryRun,
208 })
209 return oid
210}

Callers 1

_commitFunction · 0.85

Calls 3

writeObjectFunction · 0.70
fromMethod · 0.45
toObjectMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…