@es-git/checkout-mixin
Advanced tools
Comparing version 0.4.2 to 0.5.1
@@ -15,3 +15,3 @@ import { Constructor, IRawRepo, Hash } from '@es-git/core'; | ||
readonly hash: Hash; | ||
readonly mode: number; | ||
readonly isExecutable: boolean; | ||
readonly body: Uint8Array; | ||
@@ -18,0 +18,0 @@ readonly text: string; |
@@ -6,3 +6,3 @@ var __asyncValues = (this && this.__asyncIterator) || function (o) { | ||
}; | ||
import { Type, isFile, decode } from '@es-git/core'; | ||
import { Type, Mode, isFile, decode } from '@es-git/core'; | ||
export default function checkoutMixin(repo) { | ||
@@ -21,3 +21,3 @@ return class CheckoutRepo extends repo { | ||
try { | ||
for (var _a = __asyncValues(super.walkTree(commit.body.tree, true)), _b; _b = await _a.next(), !_b.done;) { | ||
for (var _a = __asyncValues(super.walkTree(commit.body.tree)), _b; _b = await _a.next(), !_b.done;) { | ||
const { path, mode, hash } = await _b.value; | ||
@@ -30,6 +30,6 @@ if (isFile(mode)) { | ||
throw new Error(`${hash} is not a blob for file ${path.join('/')}`); | ||
recursivelyMakeFile(result, path, mode, hash, file.body); | ||
recursivelyMakeFile(result, path, mode === Mode.exec, hash, file.body); | ||
} | ||
else { | ||
recursivelyMakeFolder(result, path, mode, hash); | ||
recursivelyMakeFolder(result, path, hash); | ||
} | ||
@@ -56,3 +56,3 @@ } | ||
} | ||
function recursivelyMakeFile(parent, path, mode, hash, body) { | ||
function recursivelyMakeFile(parent, path, isExecutable, hash, body) { | ||
const [name, ...subPath] = path; | ||
@@ -62,3 +62,3 @@ if (subPath.length === 0) { | ||
hash, | ||
mode, | ||
isExecutable, | ||
body, | ||
@@ -69,6 +69,6 @@ get text() { return decode(body); } | ||
else { | ||
recursivelyMakeFile(parent.folders[name], subPath, mode, hash, body); | ||
recursivelyMakeFile(parent.folders[name], subPath, isExecutable, hash, body); | ||
} | ||
} | ||
function recursivelyMakeFolder(parent, path, mode, hash) { | ||
function recursivelyMakeFolder(parent, path, hash) { | ||
const [name, ...subPath] = path; | ||
@@ -83,5 +83,5 @@ if (subPath.length === 0) { | ||
else { | ||
recursivelyMakeFolder(parent.folders[name], subPath, mode, hash); | ||
recursivelyMakeFolder(parent.folders[name], subPath, hash); | ||
} | ||
} | ||
//# sourceMappingURL=index.js.map |
@@ -120,3 +120,3 @@ "use strict"; | ||
_context.prev = 8; | ||
_a = __asyncValues((0, _get3.default)(CheckoutRepo.prototype.__proto__ || (0, _getPrototypeOf2.default)(CheckoutRepo.prototype), "walkTree", this).call(this, commit.body.tree, true)); | ||
_a = __asyncValues((0, _get3.default)(CheckoutRepo.prototype.__proto__ || (0, _getPrototypeOf2.default)(CheckoutRepo.prototype), "walkTree", this).call(this, commit.body.tree)); | ||
@@ -171,3 +171,3 @@ case 10: | ||
case 28: | ||
recursivelyMakeFile(result, path, mode, _hash, file.body); | ||
recursivelyMakeFile(result, path, mode === _core.Mode.exec, _hash, file.body); | ||
_context.next = 32; | ||
@@ -177,3 +177,3 @@ break; | ||
case 31: | ||
recursivelyMakeFolder(result, path, mode, _hash); | ||
recursivelyMakeFolder(result, path, _hash); | ||
@@ -283,3 +283,3 @@ case 32: | ||
} | ||
function recursivelyMakeFile(parent, path, mode, hash, body) { | ||
function recursivelyMakeFile(parent, path, isExecutable, hash, body) { | ||
var _path = (0, _toArray3.default)(path), | ||
@@ -292,3 +292,3 @@ name = _path[0], | ||
hash: hash, | ||
mode: mode, | ||
isExecutable: isExecutable, | ||
body: body, | ||
@@ -300,6 +300,6 @@ get text() { | ||
} else { | ||
recursivelyMakeFile(parent.folders[name], subPath, mode, hash, body); | ||
recursivelyMakeFile(parent.folders[name], subPath, isExecutable, hash, body); | ||
} | ||
} | ||
function recursivelyMakeFolder(parent, path, mode, hash) { | ||
function recursivelyMakeFolder(parent, path, hash) { | ||
var _path2 = (0, _toArray3.default)(path), | ||
@@ -316,3 +316,3 @@ name = _path2[0], | ||
} else { | ||
recursivelyMakeFolder(parent.folders[name], subPath, mode, hash); | ||
recursivelyMakeFolder(parent.folders[name], subPath, hash); | ||
} | ||
@@ -319,0 +319,0 @@ } |
{ | ||
"name": "@es-git/checkout-mixin", | ||
"version": "0.4.2", | ||
"version": "0.5.1", | ||
"description": "", | ||
@@ -42,6 +42,6 @@ "main": "js/index.js", | ||
"dependencies": { | ||
"@es-git/core": "^0.4.2", | ||
"@es-git/object-mixin": "^0.4.2", | ||
"@es-git/walkers-mixin": "^0.4.2" | ||
"@es-git/core": "^0.5.0", | ||
"@es-git/object-mixin": "^0.5.0", | ||
"@es-git/walkers-mixin": "^0.5.1" | ||
} | ||
} |
@@ -17,3 +17,3 @@ import { Type, Mode, Constructor, IRawRepo, Hash, isFile, decode } from '@es-git/core'; | ||
readonly hash : Hash | ||
readonly mode : number, | ||
readonly isExecutable : boolean, | ||
readonly body : Uint8Array, | ||
@@ -38,4 +38,4 @@ readonly text : string | ||
if(commit.type !== Type.commit) throw new Error(`${hash} is not a commit`); | ||
const result = {files: {}, folders: {}, hash: commit.body.tree}; | ||
for await(const {path, mode, hash} of super.walkTree(commit.body.tree, true)){ | ||
const result : Folder = {files: {}, folders: {}, hash: commit.body.tree}; | ||
for await(const {path, mode, hash} of super.walkTree(commit.body.tree)){ | ||
if(isFile(mode)){ | ||
@@ -45,5 +45,5 @@ const file = await super.loadObject(hash); | ||
if(file.type !== Type.blob) throw new Error(`${hash} is not a blob for file ${path.join('/')}`); | ||
recursivelyMakeFile(result, path, mode, hash, file.body); | ||
recursivelyMakeFile(result, path, mode === Mode.exec, hash, file.body); | ||
}else{ | ||
recursivelyMakeFolder(result, path, mode, hash); | ||
recursivelyMakeFolder(result, path, hash); | ||
} | ||
@@ -62,8 +62,8 @@ } | ||
function recursivelyMakeFile(parent : any, path : string[], mode : Mode, hash : Hash, body : Uint8Array){ | ||
function recursivelyMakeFile(parent : Folder, path : string[], isExecutable : boolean, hash : Hash, body : Uint8Array){ | ||
const [name, ...subPath] = path; | ||
if(subPath.length === 0){ | ||
parent.files[name] = { | ||
parent.files[name]! = { | ||
hash, | ||
mode, | ||
isExecutable, | ||
body, | ||
@@ -73,7 +73,7 @@ get text(){return decode(body)} | ||
}else{ | ||
recursivelyMakeFile(parent.folders[name], subPath, mode, hash, body); | ||
recursivelyMakeFile(parent.folders[name], subPath, isExecutable, hash, body); | ||
} | ||
} | ||
function recursivelyMakeFolder(parent : any, path : string[], mode : Mode, hash : Hash){ | ||
function recursivelyMakeFolder(parent : any, path : string[], hash : Hash){ | ||
const [name, ...subPath] = path; | ||
@@ -87,4 +87,4 @@ if(subPath.length === 0){ | ||
}else{ | ||
recursivelyMakeFolder(parent.folders[name], subPath, mode, hash); | ||
recursivelyMakeFolder(parent.folders[name], subPath, hash); | ||
} | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59787
417
+ Added@es-git/core@0.5.0(transitive)
+ Added@es-git/object-mixin@0.5.0(transitive)
+ Added@es-git/walkers-mixin@0.5.1(transitive)
- Removed@es-git/core@0.4.2(transitive)
- Removed@es-git/object-mixin@0.4.2(transitive)
- Removed@es-git/walkers-mixin@0.4.2(transitive)
Updated@es-git/core@^0.5.0
Updated@es-git/object-mixin@^0.5.0
Updated@es-git/walkers-mixin@^0.5.1