({ fs, gitdir, inode, dryRun })
| 184 | } |
| 185 | |
| 186 | async 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 | } |
no test coverage detected
searching dependent graphs…