hologit 0.50.0 → 0.50.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/TreeObject.js +26 -0
- package/package.json +1 -1
package/lib/TreeObject.js
CHANGED
|
@@ -294,6 +294,32 @@ class TreeObject {
|
|
|
294
294
|
}
|
|
295
295
|
}
|
|
296
296
|
|
|
297
|
+
/**
|
|
298
|
+
* Drop every child of this tree — both pending and base — in O(1).
|
|
299
|
+
*
|
|
300
|
+
* Semantically equivalent to calling `deleteChild` for each entry, but
|
|
301
|
+
* operates on the in-memory child maps directly so it doesn't pay for
|
|
302
|
+
* N tree mutations to produce a state that just says "this subtree is
|
|
303
|
+
* empty." The serialized result is the canonical empty-tree hash
|
|
304
|
+
* (`4b825dc642cb6eb9a060e54bf8d69288fbee4904`) — what `write()` already
|
|
305
|
+
* skips when emitting parent entries.
|
|
306
|
+
*
|
|
307
|
+
* Consumers that "clear then rewrite" — snapshot importers in
|
|
308
|
+
* particular — get a constant-time clear regardless of the prior size
|
|
309
|
+
* of the subtree.
|
|
310
|
+
*/
|
|
311
|
+
clearChildren () {
|
|
312
|
+
// Replace _children with a fresh map AND set _baseChildren to an
|
|
313
|
+
// empty object so a subsequent getChildren() / write() doesn't
|
|
314
|
+
// lazy-load the previous git tree's entries through the prototype
|
|
315
|
+
// chain. Object.seal in the constructor permits value reassignment;
|
|
316
|
+
// it only blocks add/remove of properties.
|
|
317
|
+
this._baseChildren = {};
|
|
318
|
+
this._children = {};
|
|
319
|
+
Object.setPrototypeOf(this._children, this._baseChildren);
|
|
320
|
+
this.markDirty();
|
|
321
|
+
}
|
|
322
|
+
|
|
297
323
|
async getSubtree (subtreePath, create = false) {
|
|
298
324
|
const stack = await this.getSubtreeStack(...arguments);
|
|
299
325
|
return stack && stack[stack.length - 1] || null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hologit",
|
|
3
|
-
"version": "0.50.
|
|
3
|
+
"version": "0.50.1",
|
|
4
4
|
"description": "Hologit automates the projection of layered composite file trees based on flat, declarative plans",
|
|
5
5
|
"repository": "https://github.com/JarvusInnovations/hologit",
|
|
6
6
|
"main": "lib/index.js",
|