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

Function processTreeEntries

src/utils/walkerToTreeEntryMap.js:60–92  ·  view source on GitHub ↗
({ fs, dir, gitdir, entries })

Source from the content-addressed store, hash-verified

58}
59
60async function processTreeEntries({ fs, dir, gitdir, entries }) {
61 // make sure each tree entry has valid oid
62 async function processTreeEntry(entry) {
63 if (entry.type === 'tree') {
64 if (!entry.oid) {
65 // Process children entries if the current entry is a tree
66 const children = await Promise.all(entry.children.map(processTreeEntry))
67 // Write the tree with the processed children
68 entry.oid = await _writeTree({
69 fs,
70 gitdir,
71 tree: children,
72 })
73 entry.mode = 0o40000 // directory
74 }
75 } else if (entry.type === 'blob') {
76 entry.oid = await checkAndWriteBlob(
77 fs,
78 gitdir,
79 dir,
80 entry.path,
81 entry.oid
82 )
83 entry.mode = 0o100644 // file
84 }
85
86 // remove path from entry.path
87 entry.path = entry.path.split('/').pop()
88 return entry
89 }
90
91 return Promise.all(entries.map(processTreeEntry))
92}
93
94export async function writeTreeChanges({
95 fs,

Callers 1

writeTreeChangesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…