Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.then(function(ref) {
// Convert tags to commit objects
return ref.peel(Git.Object.TYPE.COMMIT);
})
.then(function(ref) {
.then(function(object) {
var type = object.type();
if (type === git.Object.TYPE.TAG) {
// referenced object is a tag, annotated tag then
return true;
} else if (type !== git.Object.TYPE.COMMIT) {
// otherwise, should be pointing at a commit and not an annotated tag,
// but if not, then something is wrong
return "Invalid object type found for '" + theRef.name() + "' (" + type + ")";
}
return false;
});
}
function isAnnotated(repo, ref) {
// get the object being referenced and check its type
return git.Object.lookup(repo, ref.target(), git.Object.TYPE.ANY)
.then(function(object) {
var type = object.type();
if (type === git.Object.TYPE.TAG) {
// referenced object is a tag, annotated tag then
return true;
} else if (type !== git.Object.TYPE.COMMIT) {
// otherwise, should be pointing at a commit and not an annotated tag,
// but if not, then something is wrong
return "Invalid object type found for '" + theRef.name() + "' (" + type + ")";
}
return false;
});
}
return promise.then(() => {
return reference.peel(NodeGit.Object.TYPE.COMMIT);
}).then(object => {
return repo.getCommit(object.id());
if (skipCheckForURL(cfg, url)) {
return true;
}
if (skipCheckForPath(cfg, path)) {
return true;
}
const localPath = yield *exports.urlToLocalPath(repo, url);
const submoduleRepo = yield NodeGit.Repository.open(localPath);
const submoduleCommitId = submoduleEntry.id();
try {
const subrepoCommit =
yield NodeGit.Object.lookup(submoduleRepo, submoduleCommitId,
NodeGit.Object.TYPE.COMMIT);
return subrepoCommit !== null;
} catch (e) {
console.error("Could not look up ", submoduleCommitId, " in ",
localPath, ": ", e);
return false;
}
}
assert.instanceOf(submoduleEntry, NodeGit.TreeEntry);
if (skipCheckForURL(cfg, url)) {
return true;
}
if (skipCheckForPath(cfg, path)) {
return true;
}
const localPath = yield *exports.urlToLocalPath(repo, url);
const submoduleRepo = yield NodeGit.Repository.open(localPath);
const submoduleCommitId = submoduleEntry.id();
try {
const subrepoCommit =
yield NodeGit.Object.lookup(submoduleRepo, submoduleCommitId,
NodeGit.Object.TYPE.COMMIT);
return subrepoCommit !== null;
} catch (e) {
console.error("Could not look up ", submoduleCommitId, " in ",
localPath, ": ", e);
return false;
}
}
function _getTreeFromTreeEntry(treeEntry) {
if(treeEntry.isTree())
return treeEntry.getTree();
let path = treeEntry.path()
, type = treeEntry.type()
, typeName = 'UNKNOWN'
;
for(let name of Object.keys(NodeGit.Object.TYPE))
if (type === NodeGit.Object.TYPE[name]) {
typeName = name;
break;
}
throw new Error(['Entry at path: "', path, '" is not a directory (tree)!'
, 'Type is: ', typeName,' (',type,').'].join(' '));
}
.filter(treeEntry => treeEntry.type() === NodeGit.Object.TYPE.TREE)
.map(entry=>entry.path())
public async clone (p: string, reference = this.reference): Promise {
const repo = await Git.Clone(this.url, p)
const ref = await repo.getReference(reference)
const commit = await ref.peel(Git.Object.TYPE.COMMIT)
const branch = await repo.createBranch('houston', commit, true)
await repo.checkoutBranch(branch, {})
await this.recursiveClone(p)
await fs.remove(path.resolve(p, '.git'))
}
.then(function (ref) {
ref.peel(git.Object.TYPE.COMMIT)
.then(function (ref2) {
git.Commit.lookup(repository, ref2.id())
.then(function (commit) {
if (commit.sha() === COMMIT) {
COMMIT = null;
} else {
COMMIT = COMMIT.substring(0, 7);
}
setBuildVersion();
compile();
});
})
});
})