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

Function iterate

src/utils/walkerToTreeEntryMap.js:142–165  ·  view source on GitHub ↗
(walk, children)

Source from the content-addressed store, hash-verified

140
141 // if parent is skipped, skip the children
142 const iterate = async (walk, children) => {
143 const filtered = []
144 for (const child of children) {
145 const [head, stage] = child
146 if (isStage) {
147 if (stage) {
148 // for deleted file in work dir, it also needs to be added on stage
149 if (await fs.exists(`${dir}/${stage.toString()}`)) {
150 filtered.push(child)
151 } else {
152 changedEntries.push([null, stage]) // record the change (deletion) while stop the iteration
153 }
154 }
155 } else if (head) {
156 // for deleted file in workdir, "stage" (workdir in our case) will be undefined
157 if (!stage) {
158 changedEntries.push([head, null]) // record the change (deletion) while stop the iteration
159 } else {
160 filtered.push(child) // workdir, tracked only
161 }
162 }
163 }
164 return filtered.length ? Promise.all(filtered.map(walk)) : []
165 }
166
167 const entries = await _walk({
168 fs,

Callers 1

walkFunction · 0.85

Calls 2

existsMethod · 0.45
toStringMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…