hologit 0.49.0 → 0.49.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/BlobObject.js +2 -2
- package/lib/Lens.js +3 -3
- package/lib/Repo.js +1 -1
- package/lib/TreeObject.js +23 -23
- package/package.json +2 -2
package/lib/BlobObject.js
CHANGED
|
@@ -3,7 +3,7 @@ class BlobObject {
|
|
|
3
3
|
|
|
4
4
|
static async write (repo, content) {
|
|
5
5
|
const git = await repo.getGit();
|
|
6
|
-
const hash = await git
|
|
6
|
+
const hash = await git.$putBlob(content);
|
|
7
7
|
|
|
8
8
|
return new BlobObject(repo, { hash });
|
|
9
9
|
}
|
|
@@ -36,7 +36,7 @@ class BlobObject {
|
|
|
36
36
|
|
|
37
37
|
async read () {
|
|
38
38
|
const git = await this.repo.getGit();
|
|
39
|
-
return git
|
|
39
|
+
return git.$getBlob(this.hash);
|
|
40
40
|
}
|
|
41
41
|
}
|
|
42
42
|
|
package/lib/Lens.js
CHANGED
|
@@ -261,7 +261,7 @@ class Lens extends Configurable {
|
|
|
261
261
|
|
|
262
262
|
|
|
263
263
|
// determine spec type from content
|
|
264
|
-
const specToml = await git
|
|
264
|
+
const specToml = await git.$getBlob(specHash);
|
|
265
265
|
const { holospec: { lens: spec } } = TOML.parse(specToml);
|
|
266
266
|
const specType = spec.container ? 'container' : spec.package ? 'habitat' : null;
|
|
267
267
|
|
|
@@ -319,7 +319,7 @@ class Lens extends Configurable {
|
|
|
319
319
|
const git = await repo.getGit();
|
|
320
320
|
|
|
321
321
|
// read and parse spec file
|
|
322
|
-
const specToml = await git
|
|
322
|
+
const specToml = await git.$getBlob(specHash);
|
|
323
323
|
const {
|
|
324
324
|
holospec: {
|
|
325
325
|
lens: spec
|
|
@@ -474,7 +474,7 @@ class Lens extends Configurable {
|
|
|
474
474
|
}
|
|
475
475
|
} else {
|
|
476
476
|
// load spec
|
|
477
|
-
const specToml = await git
|
|
477
|
+
const specToml = await git.$getBlob(specHash);
|
|
478
478
|
const {
|
|
479
479
|
holospec: {
|
|
480
480
|
lens: spec
|
package/lib/Repo.js
CHANGED
|
@@ -157,7 +157,7 @@ class Repo {
|
|
|
157
157
|
*/
|
|
158
158
|
async hasCommit (commit) {
|
|
159
159
|
const git = await this.getGit();
|
|
160
|
-
return 'commit' == await git
|
|
160
|
+
return 'commit' == await git.$objectExists(commit);
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
async hashWorkTree () {
|
package/lib/TreeObject.js
CHANGED
|
@@ -128,21 +128,20 @@ class TreeObject {
|
|
|
128
128
|
if (!cachedHashChildren) {
|
|
129
129
|
cachedHashChildren = {};
|
|
130
130
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
if (!treeLine) {
|
|
136
|
-
continue;
|
|
137
|
-
}
|
|
131
|
+
if (preloadChildren) {
|
|
132
|
+
// recursive ls-tree: one subprocess call to load the entire tree hierarchy
|
|
133
|
+
const treeLines = (await git.lsTree({ r: true, t: true, z: true, 'full-tree': true }, this.hash)).split('\0');
|
|
134
|
+
const preloadedTrees = {};
|
|
138
135
|
|
|
139
|
-
const
|
|
136
|
+
for (const treeLine of treeLines) {
|
|
137
|
+
if (!treeLine) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
140
|
|
|
141
|
-
|
|
141
|
+
const [, mode, type, hash, childPath] = treeLineRe.exec(treeLine);
|
|
142
142
|
const parentTreePathLength = childPath.lastIndexOf('/');
|
|
143
143
|
|
|
144
144
|
if (type == 'tree') {
|
|
145
|
-
// any tree listed will have children, begin cache entry
|
|
146
145
|
preloadedTrees[childPath] = {
|
|
147
146
|
hash,
|
|
148
147
|
children: {}
|
|
@@ -150,31 +149,32 @@ class TreeObject {
|
|
|
150
149
|
}
|
|
151
150
|
|
|
152
151
|
if (parentTreePathLength == -1) {
|
|
153
|
-
// direct child, add to current result
|
|
154
152
|
cachedHashChildren[childPath] = { type, hash, mode };
|
|
155
153
|
} else {
|
|
156
154
|
preloadedTrees[childPath.substr(0, parentTreePathLength)]
|
|
157
155
|
.children[childPath.substr(parentTreePathLength+1)] = { type, hash, mode };
|
|
158
156
|
}
|
|
159
|
-
} else {
|
|
160
|
-
cachedHashChildren[childPath] = { type, hash, mode };
|
|
161
157
|
}
|
|
162
|
-
}
|
|
163
158
|
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
git.knowObject(cachedHashChildren[name].hash);
|
|
169
|
-
}
|
|
159
|
+
// populate git-client's known-objects cache
|
|
160
|
+
for (const name in cachedHashChildren) {
|
|
161
|
+
git.$knowObject(cachedHashChildren[name].hash);
|
|
162
|
+
}
|
|
170
163
|
|
|
171
|
-
if (preloadChildren) {
|
|
172
164
|
for (const treePath in preloadedTrees) {
|
|
173
165
|
const tree = preloadedTrees[treePath];
|
|
174
166
|
cacheWrite(tree.hash, tree.children);
|
|
175
|
-
git
|
|
167
|
+
git.$knowObject(tree.hash);
|
|
168
|
+
}
|
|
169
|
+
} else {
|
|
170
|
+
// non-recursive: read single tree level via cat-file --batch
|
|
171
|
+
const entries = await git.$getTree(this.hash);
|
|
172
|
+
for (const { mode, type, hash, name } of entries) {
|
|
173
|
+
cachedHashChildren[name] = { type, hash, mode };
|
|
176
174
|
}
|
|
177
175
|
}
|
|
176
|
+
|
|
177
|
+
cacheWrite(this.hash, cachedHashChildren);
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
|
|
@@ -382,7 +382,7 @@ class TreeObject {
|
|
|
382
382
|
this.hash = EMPTY_TREE_HASH;
|
|
383
383
|
} else {
|
|
384
384
|
const git = await this.repo.getGit();
|
|
385
|
-
this.hash = await git
|
|
385
|
+
this.hash = await git.$putTree(lines);
|
|
386
386
|
stats.treesWritten++;
|
|
387
387
|
}
|
|
388
388
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hologit",
|
|
3
|
-
"version": "0.49.
|
|
3
|
+
"version": "0.49.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",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"chokidar": "^5.0.0",
|
|
16
16
|
"debounce": "^3.0.0",
|
|
17
17
|
"fb-watchman": "^2.0.2",
|
|
18
|
-
"git-client": "^1.
|
|
18
|
+
"git-client": "^1.11.0",
|
|
19
19
|
"hab-client": "^1.1.3",
|
|
20
20
|
"handlebars": "^4.7.8",
|
|
21
21
|
"minimatch": "^10.2.4",
|