hologit 0.48.1 → 0.49.0

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/BlobObject.js CHANGED
@@ -3,11 +3,9 @@ class BlobObject {
3
3
 
4
4
  static async write (repo, content) {
5
5
  const git = await repo.getGit();
6
- const hashObject = await git.hashObject({ w: true, stdin: true, $spawn: true });
6
+ const hash = await git.hashObjectInternally(content, { write: true });
7
7
 
8
- return new BlobObject(repo, {
9
- hash: await hashObject.captureOutputTrimmed(content)
10
- });
8
+ return new BlobObject(repo, { hash });
11
9
  }
12
10
 
13
11
  static async writeFromFile (repo, filePath) {
package/lib/TreeObject.js CHANGED
@@ -10,12 +10,20 @@ const EMPTY_TREE_HASH = '4b825dc642cb6eb9a060e54bf8d69288fbee4904';
10
10
 
11
11
  const cache = {};
12
12
 
13
+ const stats = { treesWritten: 0, treesSkippedClean: 0, treesSkippedCached: 0, cacheHits: 0, cacheMisses: 0 };
14
+
13
15
  function cacheRead (hash) {
14
16
  if (hash == EMPTY_TREE_HASH) {
15
17
  return {};
16
18
  }
17
19
 
18
- return cache[hash] || null;
20
+ const result = cache[hash] || null;
21
+ if (result) {
22
+ stats.cacheHits++;
23
+ } else {
24
+ stats.cacheMisses++;
25
+ }
26
+ return result;
19
27
  }
20
28
 
21
29
  function cacheWrite (hash, children) {
@@ -155,10 +163,16 @@ class TreeObject {
155
163
 
156
164
  cacheWrite(this.hash, cachedHashChildren);
157
165
 
166
+ // populate git-client's known-objects cache
167
+ for (const name in cachedHashChildren) {
168
+ git.knowObject(cachedHashChildren[name].hash);
169
+ }
170
+
158
171
  if (preloadChildren) {
159
172
  for (const treePath in preloadedTrees) {
160
173
  const tree = preloadedTrees[treePath];
161
174
  cacheWrite(tree.hash, tree.children);
175
+ git.knowObject(tree.hash);
162
176
  }
163
177
  }
164
178
  }
@@ -368,7 +382,8 @@ class TreeObject {
368
382
  this.hash = EMPTY_TREE_HASH;
369
383
  } else {
370
384
  const git = await this.repo.getGit();
371
- this.hash = await git.mktreeBatch(lines);
385
+ this.hash = await git.mktreeNative(lines);
386
+ stats.treesWritten++;
372
387
  }
373
388
 
374
389
 
@@ -546,6 +561,8 @@ class TreeObject {
546
561
  }
547
562
 
548
563
  TreeObject.treeLineRe = treeLineRe;
564
+ TreeObject.stats = stats;
565
+ TreeObject.resetStats = () => Object.keys(stats).forEach(k => stats[k] = 0);
549
566
 
550
567
  TreeObject.prototype.isTree = true;
551
568
  TreeObject.prototype.type = 'tree';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hologit",
3
- "version": "0.48.1",
3
+ "version": "0.49.0",
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",
@@ -11,18 +11,18 @@
11
11
  "dependencies": {
12
12
  "@iarna/toml": "^2.2.5",
13
13
  "async-exit-hook": "^2.0.1",
14
- "axios": "^1.13.5",
14
+ "axios": "^1.13.6",
15
15
  "chokidar": "^5.0.0",
16
16
  "debounce": "^3.0.0",
17
17
  "fb-watchman": "^2.0.2",
18
- "git-client": "^1.9.4",
18
+ "git-client": "^1.10.1",
19
19
  "hab-client": "^1.1.3",
20
20
  "handlebars": "^4.7.8",
21
- "minimatch": "^10.2.2",
21
+ "minimatch": "^10.2.4",
22
22
  "mz": "^2.7.0",
23
23
  "mz-modules": "^2.1.0",
24
24
  "object-squish": "^1.1.0",
25
- "parse-url": "^10.0.3",
25
+ "parse-url": "^11.1.0",
26
26
  "shell-quote-word": "^1.0.1",
27
27
  "sort-keys": "^6.0.0",
28
28
  "toposort": "^2.0.2",
@@ -49,9 +49,10 @@
49
49
  ],
50
50
  "devDependencies": {
51
51
  "@types/jest": "^30.0.0",
52
- "jest": "^30.2.0"
52
+ "jest": "^30.3.0"
53
53
  },
54
54
  "scripts": {
55
- "test": "jest"
55
+ "test": "jest",
56
+ "bench": "node test/benchmark/projection.bench.js"
56
57
  }
57
58
  }