Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

isomorphic-git

Package Overview
Dependencies
Maintainers
1
Versions
408
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

isomorphic-git - npm Package Compare versions

Comparing version 0.0.7 to 0.0.8

43

dist/for-browserify/index.js

@@ -9,3 +9,2 @@ 'use strict';

var _createClass = _interopDefault(require('babel-runtime/helpers/createClass'));
var ghurl = _interopDefault(require('github-url-to-object'));
var commands_js = require('./commands.js');

@@ -29,2 +28,3 @@

this.operateDepth = 0;
this.operateBranch = 'master';
}

@@ -63,2 +63,8 @@

}, {
key: 'branch',
value: function branch(name) {
this.operateBranch = name;
return this;
}
}, {
key: 'email',

@@ -210,2 +216,3 @@ value: function email(_email) {

var _ref4 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee4(url) {
var params;
return _regeneratorRuntime.wrap(function _callee4$(_context4) {

@@ -220,23 +227,35 @@ while (1) {

_context4.next = 4;
return commands_js.GithubFetch({
return commands_js.setConfig({
gitdir: this.gitdir,
// TODO: make this not Github-specific
user: ghurl(url).user,
repo: ghurl(url).repo,
ref: ghurl(url).branch,
remote: this.operateRemote,
token: this.operateToken
path: 'remote.origin.url',
value: url
});
case 4:
_context4.next = 6;
// Fetch commits
params = {};
params.remote = this.operateRemote;
if (this.operateToken) {
params.auth = {
username: this.operateToken,
password: this.operateToken
};
}
params.gitdir = this.gitdir;
params.ref = 'refs/heads/' + this.operateBranch;
params.depth = this.operateDepth;
_context4.next = 12;
return commands_js.fetch(params);
case 12:
_context4.next = 14;
return commands_js.checkout({
workdir: this.workdir,
gitdir: this.gitdir,
// TODO: make this not Github-specific
ref: ghurl(url).branch,
ref: this.operateBranch,
remote: this.operateRemote
});
case 6:
case 14:
case 'end':

@@ -243,0 +262,0 @@ return _context4.stop();

@@ -613,3 +613,3 @@ 'use strict';

var name = "isomorphic-git";
var version = "0.0.7";
var version = "0.0.8";
var description = "Node library for interacting with git repositories, circa 2017";

@@ -622,10 +622,10 @@ var main = "dist/for-node/";

var scripts = { "format": "prettier-standard src/**/*.js test/**/*.js testling/**/*.js *.js", "lint": "standard src/**/*.js", "watch": "rollup -cw", "build": "npm-run-all -s build:rollup build:umd", "build:rollup": "rollup -c", "build:umd": "browserify --entry dist/for-browserify/index.js --standalone git | uglifyjs > dist/bundle.umd.min.js", "test": "npm-run-all -s build -p test:travis test:travis:karma", "test:travis": "npm-run-all -s test:travis:ava test:travis:nyc test:travis:codecov", "test:travis:ava": "ava", "test:travis:nyc": "nyc ava || echo 'nyc failed, no big deal'", "test:travis:codecov": "nyc report --reporter=lcov > coverage.lcov && codecov || echo 'codecov failed, no big deal'", "test:travis:karma": "karma start ci.karma.conf.js || echo 'saucelabs failed, no big deal'", "precommit": "npm run format" };
var repository = { "type": "git", "url": "git+https://github.com/wmhilton/esgit.git" };
var repository = { "type": "git", "url": "git+https://github.com/wmhilton/isomorphic-git.git" };
var keywords = ["git"];
var author = "William Hilton <wmhilton@gmail.com>";
var license = "Unlicense";
var bugs = { "url": "https://github.com/wmhilton/esgit/issues" };
var homepage = "https://github.com/wmhilton/esgit#readme";
var bugs = { "url": "https://github.com/wmhilton/isomorphic-git/issues" };
var homepage = "https://github.com/wmhilton/isomorphic-git#readme";
var files = ["dist", "cli.js"];
var dependencies = { "async-lock": "^1.0.0", "await-stream-ready": "^1.0.1", "babel-runtime": "^6.26.0", "buffer": "^5.0.7", "buffer-peek-stream": "^1.0.1", "buffercursor": "0.0.12", "gartal": "^1.1.2", "git-apply-delta": "0.0.7", "git-list-pack": "0.0.10", "github-url-to-object": "^4.0.2", "ini": "^1.3.4", "minimisted": "^2.0.0", "openpgp": "^2.5.10", "pad": "^1.1.0", "pako": "^1.0.5", "parse-link-header": "^1.0.1", "pify": "^3.0.0", "shasum": "^1.0.2", "simple-concat": "^1.0.0", "simple-get": "^2.7.0", "thru": "0.0.2" };
var dependencies = { "async-lock": "^1.0.0", "await-stream-ready": "^1.0.1", "babel-runtime": "^6.26.0", "buffer": "^5.0.7", "buffer-peek-stream": "^1.0.1", "buffercursor": "0.0.12", "gartal": "^1.1.2", "git-apply-delta": "0.0.7", "git-list-pack": "0.0.10", "ini": "^1.3.4", "minimisted": "^2.0.0", "openpgp": "^2.5.10", "pad": "^1.1.0", "pako": "^1.0.5", "pify": "^3.0.0", "shasum": "^1.0.2", "simple-concat": "^1.0.0", "simple-get": "^2.7.0", "thru": "0.0.2" };
var devDependencies = { "ava": "^0.21.0", "babel-plugin-external-helpers": "^6.22.0", "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", "babel-plugin-transform-object-rest-spread": "^6.23.0", "babel-plugin-transform-runtime": "^6.23.0", "babel-preset-env": "^1.6.0", "babel-preset-flow": "^6.23.0", "ban-sensitive-files": "^1.9.0", "browserfs": "^1.4.3", "browserify": "^14.4.0", "browserify-shim": "^3.8.14", "codecov": "^2.3.0", "husky": "^0.14.3", "jsonfile": "^3.0.1", "karma": "^1.7.1", "karma-browserify": "^5.1.1", "karma-chrome-launcher": "^2.2.0", "karma-firefox-launcher": "^1.0.1", "karma-sauce-launcher": "^1.2.0", "karma-tap": "^3.1.1", "lodash": "^4.17.4", "ncp": "^2.0.0", "nock": "^9.0.17", "npm-run-all": "^4.1.1", "nyc": "^11.2.1", "parse-header-stream": "^1.1.1", "prettier-standard": "^6.0.0", "rollup": "^0.50.0", "rollup-plugin-babel": "^3.0.2", "rollup-plugin-json": "^2.3.0", "standard": "^10.0.3", "stream-equal": "^1.0.1", "tape": "^4.8.0", "temp": "^0.8.3", "uglify-es": "^3.1.2", "watchify": "^3.9.0" };

@@ -632,0 +632,0 @@ var ava = { "source": ["dist/for-node/*"] };

@@ -12,5 +12,2 @@ import path from 'path';

import applyDelta from 'git-apply-delta';
import simpleGet from 'simple-get';
import concat from 'simple-concat';
import parseLinkHeader from 'parse-link-header';
import pad from 'pad';

@@ -354,191 +351,2 @@ import pako from 'pako';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
// We're implementing a non-standard clone based on the Github API first, because of CORS.
// And because we already have the code.
async function request({ url, token, headers }) {
let res = await pify(simpleGet)({
url,
headers: _extends({
Accept: 'application/vnd.github.v3+json',
Authorization: 'token ' + token
}, headers)
});
let data = await pify(concat)(res);
return JSON.parse(data.toString('utf8'));
}
async function fetchRemoteBranches({ gitdir, remote, user, repo, token }) {
return request({
token,
url: `https://api.github.com/repos/${user}/${repo}/branches`
}).then(json => Promise.all(json.map(branch => write(`${gitdir}/refs/remotes/${remote}/${branch.name}`, branch.commit.sha + '\n', { encoding: 'utf8' }))));
}
async function fetchTags({ gitdir, user, repo, token }) {
return request({
token,
url: `https://api.github.com/repos/${user}/${repo}/tags`
}).then(json => Promise.all(json.map(tag =>
// Curiously, tags are not separated between remotes like branches
write(`${gitdir}/refs/tags/${tag.name}`, tag.commit.sha + '\n', {
encoding: 'utf8'
}))));
}
async function fetchCommits({ gitdir, url, user, repo, ref, since, token }) {
if (!url) {
url = `https://api.github.com/repos/${user}/${repo}/commits?`;
if (ref) url += `&sha=${ref}`;
if (since) {
let date = new Date(since * 1000).toISOString();
url += `&since=${date}`;
}
}
let res = await pify(simpleGet)({
url,
headers: {
Accept: 'application/vnd.github.cryptographer-preview',
Authorization: 'token ' + token
}
});
let data = await pify(concat)(res);
let json = JSON.parse(data.toString('utf8'));
let link = parseLinkHeader(res.headers['link']);
for (let commit of json) {
if (!commit.commit.verification.payload) {
console.log(`Commit ${commit.sha} skipped. Due to a technical limitations and my laziness, only signed commits can be cloned from Github over the API`);
continue;
}
let comm = GitCommit.fromPayloadSignature({
payload: commit.commit.verification.payload,
signature: commit.commit.verification.signature
});
console.log('Created commit', comm);
let oid = await GitObjectManager.write({
gitdir,
type: 'commit',
object: comm.toObject()
});
if (commit.sha !== oid) {
console.log("AHOY! MATEY! THAR BE TROUBLE WITH 'EM HASHES!");
}
console.log(`Stored commit ${commit.sha}`);
}
if (link && link.next) {
return fetchCommits({
gitdir,
user,
repo,
ref,
since,
token,
url: link.next.url
});
}
}
async function fetchTree({ gitdir, url, user, repo, sha, since, token }) {
let json = await request({
token,
url: `https://api.github.com/repos/${user}/${repo}/git/trees/${sha}`
});
let tree = new GitTree(json.tree);
let oid = await GitObjectManager.write({
gitdir,
type: 'tree',
object: tree.toObject()
});
if (sha !== oid) {
console.log("AHOY! MATEY! THAR BE TROUBLE WITH 'EM HASHES!");
}
console.log(tree.render());
return Promise.all(json.tree.map(async entry => {
if (entry.type === 'blob') {
await fetchBlob({
gitdir,
url,
user,
repo,
sha: entry.sha,
since,
token
});
} else if (entry.type === 'tree') {
await fetchTree({
gitdir,
url,
user,
repo,
sha: entry.sha,
since,
token
});
}
}));
}
async function fetchBlob({ gitdir, url, user, repo, sha, since, token }) {
let res = await pify(simpleGet)({
url: `https://api.github.com/repos/${user}/${repo}/git/blobs/${sha}`,
headers: {
Accept: 'application/vnd.github.raw',
Authorization: 'token ' + token
}
});
let data = await pify(concat)(res);
let oid = await GitObjectManager.write({
gitdir,
type: 'blob',
object: data
});
if (sha !== oid) {
console.log("AHOY! MATEY! THAR BE TROUBLE WITH 'EM HASHES!");
}
}
async function GithubFetch({
gitdir,
token,
user,
repo,
ref,
remote,
since
}) {
let json;
if (!ref) {
console.log('Determining the default branch');
json = await request({
token,
url: `https://api.github.com/repos/${user}/${repo}`
});
ref = json.default_branch;
}
console.log('Receiving branches list');
let getBranches = fetchRemoteBranches({ gitdir, remote, user, repo, token });
console.log('Receiving tags list');
let getTags = fetchTags({ gitdir, user, repo, token });
console.log('Receiving commits');
let getCommits = fetchCommits({ gitdir, user, repo, token, ref });
await Promise.all([getBranches, getTags, getCommits]);
// This is all crap to get a tree SHA from a commit SHA. Seriously.
let oid = await resolveRef({ gitdir, ref: `${remote}/${ref}` });
let { type, object } = await GitObjectManager.read({ gitdir, oid });
if (type !== 'commit') throw new Error(`Unexpected type: ${type}`);
let comm = GitCommit.from(object.toString('utf8'));
let sha = comm.headers().tree;
console.log('tree: ', sha);
await fetchTree({ gitdir, user, repo, token, sha });
}
// @flow

@@ -773,2 +581,2 @@ async function init(gitdir /*: string */) {

export { add, checkout, commit, fetch, GithubFetch, getConfig, init, list, listCommits, listObjects, pack, push, remove, setConfig, unpack, verify };
export { add, checkout, commit, fetch, getConfig, init, list, listCommits, listObjects, pack, push, remove, setConfig, unpack, verify };

@@ -1,3 +0,2 @@

import ghurl from 'github-url-to-object';
import { GithubFetch, add, checkout, commit, fetch, getConfig, init, list, pack, push, remove, setConfig, unpack, verify } from './commands.js';
import { add, checkout, commit, fetch, getConfig, init, list, pack, push, remove, setConfig, unpack, verify } from './commands.js';

@@ -17,2 +16,3 @@ function git(dir) {

this.operateDepth = 0;
this.operateBranch = 'master';
}

@@ -39,2 +39,6 @@ workdir(dir) {

}
branch(name) {
this.operateBranch = name;
return this;
}
email(email) {

@@ -101,17 +105,26 @@ this.operateAuthorEmail = email;

await init(this.gitdir);
// await addRemote()
await GithubFetch({
// Add remote
await setConfig({
gitdir: this.gitdir,
// TODO: make this not Github-specific
user: ghurl(url).user,
repo: ghurl(url).repo,
ref: ghurl(url).branch,
remote: this.operateRemote,
token: this.operateToken
path: 'remote.origin.url',
value: url
});
// Fetch commits
let params = {};
params.remote = this.operateRemote;
if (this.operateToken) {
params.auth = {
username: this.operateToken,
password: this.operateToken
};
}
params.gitdir = this.gitdir;
params.ref = `refs/heads/${this.operateBranch}`;
params.depth = this.operateDepth;
await fetch(params);
// Checkout branch
await checkout({
workdir: this.workdir,
gitdir: this.gitdir,
// TODO: make this not Github-specific
ref: ghurl(url).branch,
ref: this.operateBranch,
remote: this.operateRemote

@@ -118,0 +131,0 @@ });

@@ -218,3 +218,3 @@ import systemfs from 'fs';

var name = "isomorphic-git";
var version = "0.0.7";
var version = "0.0.8";
var description = "Node library for interacting with git repositories, circa 2017";

@@ -227,10 +227,10 @@ var main = "dist/for-node/";

var scripts = { "format": "prettier-standard src/**/*.js test/**/*.js testling/**/*.js *.js", "lint": "standard src/**/*.js", "watch": "rollup -cw", "build": "npm-run-all -s build:rollup build:umd", "build:rollup": "rollup -c", "build:umd": "browserify --entry dist/for-browserify/index.js --standalone git | uglifyjs > dist/bundle.umd.min.js", "test": "npm-run-all -s build -p test:travis test:travis:karma", "test:travis": "npm-run-all -s test:travis:ava test:travis:nyc test:travis:codecov", "test:travis:ava": "ava", "test:travis:nyc": "nyc ava || echo 'nyc failed, no big deal'", "test:travis:codecov": "nyc report --reporter=lcov > coverage.lcov && codecov || echo 'codecov failed, no big deal'", "test:travis:karma": "karma start ci.karma.conf.js || echo 'saucelabs failed, no big deal'", "precommit": "npm run format" };
var repository = { "type": "git", "url": "git+https://github.com/wmhilton/esgit.git" };
var repository = { "type": "git", "url": "git+https://github.com/wmhilton/isomorphic-git.git" };
var keywords = ["git"];
var author = "William Hilton <wmhilton@gmail.com>";
var license = "Unlicense";
var bugs = { "url": "https://github.com/wmhilton/esgit/issues" };
var homepage = "https://github.com/wmhilton/esgit#readme";
var bugs = { "url": "https://github.com/wmhilton/isomorphic-git/issues" };
var homepage = "https://github.com/wmhilton/isomorphic-git#readme";
var files = ["dist", "cli.js"];
var dependencies = { "async-lock": "^1.0.0", "await-stream-ready": "^1.0.1", "babel-runtime": "^6.26.0", "buffer": "^5.0.7", "buffer-peek-stream": "^1.0.1", "buffercursor": "0.0.12", "gartal": "^1.1.2", "git-apply-delta": "0.0.7", "git-list-pack": "0.0.10", "github-url-to-object": "^4.0.2", "ini": "^1.3.4", "minimisted": "^2.0.0", "openpgp": "^2.5.10", "pad": "^1.1.0", "pako": "^1.0.5", "parse-link-header": "^1.0.1", "pify": "^3.0.0", "shasum": "^1.0.2", "simple-concat": "^1.0.0", "simple-get": "^2.7.0", "thru": "0.0.2" };
var dependencies = { "async-lock": "^1.0.0", "await-stream-ready": "^1.0.1", "babel-runtime": "^6.26.0", "buffer": "^5.0.7", "buffer-peek-stream": "^1.0.1", "buffercursor": "0.0.12", "gartal": "^1.1.2", "git-apply-delta": "0.0.7", "git-list-pack": "0.0.10", "ini": "^1.3.4", "minimisted": "^2.0.0", "openpgp": "^2.5.10", "pad": "^1.1.0", "pako": "^1.0.5", "pify": "^3.0.0", "shasum": "^1.0.2", "simple-concat": "^1.0.0", "simple-get": "^2.7.0", "thru": "0.0.2" };
var devDependencies = { "ava": "^0.21.0", "babel-plugin-external-helpers": "^6.22.0", "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", "babel-plugin-transform-object-rest-spread": "^6.23.0", "babel-plugin-transform-runtime": "^6.23.0", "babel-preset-env": "^1.6.0", "babel-preset-flow": "^6.23.0", "ban-sensitive-files": "^1.9.0", "browserfs": "^1.4.3", "browserify": "^14.4.0", "browserify-shim": "^3.8.14", "codecov": "^2.3.0", "husky": "^0.14.3", "jsonfile": "^3.0.1", "karma": "^1.7.1", "karma-browserify": "^5.1.1", "karma-chrome-launcher": "^2.2.0", "karma-firefox-launcher": "^1.0.1", "karma-sauce-launcher": "^1.2.0", "karma-tap": "^3.1.1", "lodash": "^4.17.4", "ncp": "^2.0.0", "nock": "^9.0.17", "npm-run-all": "^4.1.1", "nyc": "^11.2.1", "parse-header-stream": "^1.1.1", "prettier-standard": "^6.0.0", "rollup": "^0.50.0", "rollup-plugin-babel": "^3.0.2", "rollup-plugin-json": "^2.3.0", "standard": "^10.0.3", "stream-equal": "^1.0.1", "tape": "^4.8.0", "temp": "^0.8.3", "uglify-es": "^3.1.2", "watchify": "^3.9.0" };

@@ -237,0 +237,0 @@ var ava = { "source": ["dist/for-node/*"] };

@@ -18,5 +18,2 @@ 'use strict';

var applyDelta = _interopDefault(require('git-apply-delta'));
var simpleGet = _interopDefault(require('simple-get'));
var concat = _interopDefault(require('simple-concat'));
var parseLinkHeader = _interopDefault(require('parse-link-header'));
var pad = _interopDefault(require('pad'));

@@ -360,189 +357,2 @@ var pako = _interopDefault(require('pako'));

// We're implementing a non-standard clone based on the Github API first, because of CORS.
// And because we already have the code.
async function request({ url, token, headers }) {
let res = await pify(simpleGet)({
url,
headers: babelHelpers.extends({
Accept: 'application/vnd.github.v3+json',
Authorization: 'token ' + token
}, headers)
});
let data = await pify(concat)(res);
return JSON.parse(data.toString('utf8'));
}
async function fetchRemoteBranches({ gitdir, remote, user, repo, token }) {
return request({
token,
url: `https://api.github.com/repos/${user}/${repo}/branches`
}).then(json => Promise.all(json.map(branch => utils_js.write(`${gitdir}/refs/remotes/${remote}/${branch.name}`, branch.commit.sha + '\n', { encoding: 'utf8' }))));
}
async function fetchTags({ gitdir, user, repo, token }) {
return request({
token,
url: `https://api.github.com/repos/${user}/${repo}/tags`
}).then(json => Promise.all(json.map(tag =>
// Curiously, tags are not separated between remotes like branches
utils_js.write(`${gitdir}/refs/tags/${tag.name}`, tag.commit.sha + '\n', {
encoding: 'utf8'
}))));
}
async function fetchCommits({ gitdir, url, user, repo, ref, since, token }) {
if (!url) {
url = `https://api.github.com/repos/${user}/${repo}/commits?`;
if (ref) url += `&sha=${ref}`;
if (since) {
let date = new Date(since * 1000).toISOString();
url += `&since=${date}`;
}
}
let res = await pify(simpleGet)({
url,
headers: {
Accept: 'application/vnd.github.cryptographer-preview',
Authorization: 'token ' + token
}
});
let data = await pify(concat)(res);
let json = JSON.parse(data.toString('utf8'));
let link = parseLinkHeader(res.headers['link']);
for (let commit of json) {
if (!commit.commit.verification.payload) {
console.log(`Commit ${commit.sha} skipped. Due to a technical limitations and my laziness, only signed commits can be cloned from Github over the API`);
continue;
}
let comm = models_js.GitCommit.fromPayloadSignature({
payload: commit.commit.verification.payload,
signature: commit.commit.verification.signature
});
console.log('Created commit', comm);
let oid = await managers_js.GitObjectManager.write({
gitdir,
type: 'commit',
object: comm.toObject()
});
if (commit.sha !== oid) {
console.log("AHOY! MATEY! THAR BE TROUBLE WITH 'EM HASHES!");
}
console.log(`Stored commit ${commit.sha}`);
}
if (link && link.next) {
return fetchCommits({
gitdir,
user,
repo,
ref,
since,
token,
url: link.next.url
});
}
}
async function fetchTree({ gitdir, url, user, repo, sha, since, token }) {
let json = await request({
token,
url: `https://api.github.com/repos/${user}/${repo}/git/trees/${sha}`
});
let tree = new models_js.GitTree(json.tree);
let oid = await managers_js.GitObjectManager.write({
gitdir,
type: 'tree',
object: tree.toObject()
});
if (sha !== oid) {
console.log("AHOY! MATEY! THAR BE TROUBLE WITH 'EM HASHES!");
}
console.log(tree.render());
return Promise.all(json.tree.map(async entry => {
if (entry.type === 'blob') {
await fetchBlob({
gitdir,
url,
user,
repo,
sha: entry.sha,
since,
token
});
} else if (entry.type === 'tree') {
await fetchTree({
gitdir,
url,
user,
repo,
sha: entry.sha,
since,
token
});
}
}));
}
async function fetchBlob({ gitdir, url, user, repo, sha, since, token }) {
let res = await pify(simpleGet)({
url: `https://api.github.com/repos/${user}/${repo}/git/blobs/${sha}`,
headers: {
Accept: 'application/vnd.github.raw',
Authorization: 'token ' + token
}
});
let data = await pify(concat)(res);
let oid = await managers_js.GitObjectManager.write({
gitdir,
type: 'blob',
object: data
});
if (sha !== oid) {
console.log("AHOY! MATEY! THAR BE TROUBLE WITH 'EM HASHES!");
}
}
async function GithubFetch({
gitdir,
token,
user,
repo,
ref,
remote,
since
}) {
let json;
if (!ref) {
console.log('Determining the default branch');
json = await request({
token,
url: `https://api.github.com/repos/${user}/${repo}`
});
ref = json.default_branch;
}
console.log('Receiving branches list');
let getBranches = fetchRemoteBranches({ gitdir, remote, user, repo, token });
console.log('Receiving tags list');
let getTags = fetchTags({ gitdir, user, repo, token });
console.log('Receiving commits');
let getCommits = fetchCommits({ gitdir, user, repo, token, ref });
await Promise.all([getBranches, getTags, getCommits]);
// This is all crap to get a tree SHA from a commit SHA. Seriously.
let oid = await utils_js.resolveRef({ gitdir, ref: `${remote}/${ref}` });
let { type, object } = await managers_js.GitObjectManager.read({ gitdir, oid });
if (type !== 'commit') throw new Error(`Unexpected type: ${type}`);
let comm = models_js.GitCommit.from(object.toString('utf8'));
let sha = comm.headers().tree;
console.log('tree: ', sha);
await fetchTree({ gitdir, user, repo, token, sha });
}
// @flow

@@ -781,3 +591,2 @@ async function init(gitdir /*: string */) {

exports.fetch = fetch;
exports.GithubFetch = GithubFetch;
exports.getConfig = getConfig;

@@ -784,0 +593,0 @@ exports.init = init;

'use strict';
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var ghurl = _interopDefault(require('github-url-to-object'));
var commands_js = require('./commands.js');

@@ -21,2 +18,3 @@

this.operateDepth = 0;
this.operateBranch = 'master';
}

@@ -43,2 +41,6 @@ workdir(dir) {

}
branch(name) {
this.operateBranch = name;
return this;
}
email(email) {

@@ -105,17 +107,26 @@ this.operateAuthorEmail = email;

await commands_js.init(this.gitdir);
// await addRemote()
await commands_js.GithubFetch({
// Add remote
await commands_js.setConfig({
gitdir: this.gitdir,
// TODO: make this not Github-specific
user: ghurl(url).user,
repo: ghurl(url).repo,
ref: ghurl(url).branch,
remote: this.operateRemote,
token: this.operateToken
path: 'remote.origin.url',
value: url
});
// Fetch commits
let params = {};
params.remote = this.operateRemote;
if (this.operateToken) {
params.auth = {
username: this.operateToken,
password: this.operateToken
};
}
params.gitdir = this.gitdir;
params.ref = `refs/heads/${this.operateBranch}`;
params.depth = this.operateDepth;
await commands_js.fetch(params);
// Checkout branch
await commands_js.checkout({
workdir: this.workdir,
gitdir: this.gitdir,
// TODO: make this not Github-specific
ref: ghurl(url).branch,
ref: this.operateBranch,
remote: this.operateRemote

@@ -122,0 +133,0 @@ });

@@ -224,3 +224,3 @@ 'use strict';

var name = "isomorphic-git";
var version = "0.0.7";
var version = "0.0.8";
var description = "Node library for interacting with git repositories, circa 2017";

@@ -233,10 +233,10 @@ var main = "dist/for-node/";

var scripts = { "format": "prettier-standard src/**/*.js test/**/*.js testling/**/*.js *.js", "lint": "standard src/**/*.js", "watch": "rollup -cw", "build": "npm-run-all -s build:rollup build:umd", "build:rollup": "rollup -c", "build:umd": "browserify --entry dist/for-browserify/index.js --standalone git | uglifyjs > dist/bundle.umd.min.js", "test": "npm-run-all -s build -p test:travis test:travis:karma", "test:travis": "npm-run-all -s test:travis:ava test:travis:nyc test:travis:codecov", "test:travis:ava": "ava", "test:travis:nyc": "nyc ava || echo 'nyc failed, no big deal'", "test:travis:codecov": "nyc report --reporter=lcov > coverage.lcov && codecov || echo 'codecov failed, no big deal'", "test:travis:karma": "karma start ci.karma.conf.js || echo 'saucelabs failed, no big deal'", "precommit": "npm run format" };
var repository = { "type": "git", "url": "git+https://github.com/wmhilton/esgit.git" };
var repository = { "type": "git", "url": "git+https://github.com/wmhilton/isomorphic-git.git" };
var keywords = ["git"];
var author = "William Hilton <wmhilton@gmail.com>";
var license = "Unlicense";
var bugs = { "url": "https://github.com/wmhilton/esgit/issues" };
var homepage = "https://github.com/wmhilton/esgit#readme";
var bugs = { "url": "https://github.com/wmhilton/isomorphic-git/issues" };
var homepage = "https://github.com/wmhilton/isomorphic-git#readme";
var files = ["dist", "cli.js"];
var dependencies = { "async-lock": "^1.0.0", "await-stream-ready": "^1.0.1", "babel-runtime": "^6.26.0", "buffer": "^5.0.7", "buffer-peek-stream": "^1.0.1", "buffercursor": "0.0.12", "gartal": "^1.1.2", "git-apply-delta": "0.0.7", "git-list-pack": "0.0.10", "github-url-to-object": "^4.0.2", "ini": "^1.3.4", "minimisted": "^2.0.0", "openpgp": "^2.5.10", "pad": "^1.1.0", "pako": "^1.0.5", "parse-link-header": "^1.0.1", "pify": "^3.0.0", "shasum": "^1.0.2", "simple-concat": "^1.0.0", "simple-get": "^2.7.0", "thru": "0.0.2" };
var dependencies = { "async-lock": "^1.0.0", "await-stream-ready": "^1.0.1", "babel-runtime": "^6.26.0", "buffer": "^5.0.7", "buffer-peek-stream": "^1.0.1", "buffercursor": "0.0.12", "gartal": "^1.1.2", "git-apply-delta": "0.0.7", "git-list-pack": "0.0.10", "ini": "^1.3.4", "minimisted": "^2.0.0", "openpgp": "^2.5.10", "pad": "^1.1.0", "pako": "^1.0.5", "pify": "^3.0.0", "shasum": "^1.0.2", "simple-concat": "^1.0.0", "simple-get": "^2.7.0", "thru": "0.0.2" };
var devDependencies = { "ava": "^0.21.0", "babel-plugin-external-helpers": "^6.22.0", "babel-plugin-transform-es2015-modules-commonjs": "^6.24.1", "babel-plugin-transform-object-rest-spread": "^6.23.0", "babel-plugin-transform-runtime": "^6.23.0", "babel-preset-env": "^1.6.0", "babel-preset-flow": "^6.23.0", "ban-sensitive-files": "^1.9.0", "browserfs": "^1.4.3", "browserify": "^14.4.0", "browserify-shim": "^3.8.14", "codecov": "^2.3.0", "husky": "^0.14.3", "jsonfile": "^3.0.1", "karma": "^1.7.1", "karma-browserify": "^5.1.1", "karma-chrome-launcher": "^2.2.0", "karma-firefox-launcher": "^1.0.1", "karma-sauce-launcher": "^1.2.0", "karma-tap": "^3.1.1", "lodash": "^4.17.4", "ncp": "^2.0.0", "nock": "^9.0.17", "npm-run-all": "^4.1.1", "nyc": "^11.2.1", "parse-header-stream": "^1.1.1", "prettier-standard": "^6.0.0", "rollup": "^0.50.0", "rollup-plugin-babel": "^3.0.2", "rollup-plugin-json": "^2.3.0", "standard": "^10.0.3", "stream-equal": "^1.0.1", "tape": "^4.8.0", "temp": "^0.8.3", "uglify-es": "^3.1.2", "watchify": "^3.9.0" };

@@ -243,0 +243,0 @@ var ava = { "source": ["dist/for-node/*"] };

@@ -1,2 +0,2 @@

# [isomorphic-git](https://github.com/wmhilton/esgit)
# [isomorphic-git](https://github.com/wmhilton/isomorphic-git)

@@ -3,0 +3,0 @@ These are the "distributable" versions i.e. what's installed by npm.

{
"name": "isomorphic-git",
"version": "0.0.7",
"version": "0.0.8",
"description": "Node library for interacting with git repositories, circa 2017",

@@ -31,3 +31,3 @@ "main": "dist/for-node/",

"type": "git",
"url": "git+https://github.com/wmhilton/esgit.git"
"url": "git+https://github.com/wmhilton/isomorphic-git.git"
},

@@ -40,5 +40,5 @@ "keywords": [

"bugs": {
"url": "https://github.com/wmhilton/esgit/issues"
"url": "https://github.com/wmhilton/isomorphic-git/issues"
},
"homepage": "https://github.com/wmhilton/esgit#readme",
"homepage": "https://github.com/wmhilton/isomorphic-git#readme",
"files": [

@@ -58,3 +58,2 @@ "dist",

"git-list-pack": "0.0.10",
"github-url-to-object": "^4.0.2",
"ini": "^1.3.4",

@@ -65,3 +64,2 @@ "minimisted": "^2.0.0",

"pako": "^1.0.5",
"parse-link-header": "^1.0.1",
"pify": "^3.0.0",

@@ -68,0 +66,0 @@ "shasum": "^1.0.2",

@@ -13,6 +13,10 @@ # isomorphic-git [![Build Status](https://travis-ci.org/wmhilton/isomorphic-git.svg?branch=master)](https://travis-ci.org/wmhilton/isomorphic-git) [![codecov](https://codecov.io/gh/wmhilton/isomorphic-git/branch/master/graph/badge.svg)](https://codecov.io/gh/wmhilton/isomorphic-git)

- [x] git init
- [ ] git config
- [x] git checkout
- [ ] update index correctly when checking out
- [x] git clone
- [x] git init
- [x] git config
- [x] git fetch (due to CORS, use https://cors-anywhere.herokuapp.com/https://github.com instead of https://github.com)
- [x] ref-deltas
- [ ] ofs-deltas
- [x] git checkout
- [ ] update index SHA correctly
- [x] git list (ls-files)

@@ -24,7 +28,2 @@ - [x] git add

- [x] git push (due to CORS, use https://cors-anywhere.herokuapp.com/https://github.com instead of https://github.com)
- [x] git fetch (due to CORS, use https://cors-anywhere.herokuapp.com/https://github.com instead of https://github.com)
- [x] ref-deltas
- [ ] ofs-deltas
- [ ] git pull
- [ ] Update refs and HEAD
- [ ] git tag

@@ -54,10 +53,16 @@ - [ ] git diff

// Create a new empty repo
git('test').init()
// Clone a repository
git('.')
.depth(1)
.branch('master')
.clone('https://cors-anywhere.herokuapp.com/https://github.com/wmhilton/isomorphic-git')
// Manually add a remote (git clone should be doing this automatically but it doesn't (yet))
// Setup an new repository
git('.').init()
// Manually add a remote
git('.')
.setConfig('remote.origin.url', 'https://cors-anywhere.herokuapp.com/https://github.com/wmhilton/isomorphic-git')
// Fetch the latest version from a Github repository using a shallow clone
// Fetch the latest commit using a shallow clone
git('.')

@@ -106,3 +111,3 @@ .remote('origin')

I built a purely a generic translator and it worked surprisingly well.
So you can do *any* current or future esgit commands using the included `esgit` CLI.
So you can do *any* current or future isomorphic-git commands using the included `esgit` CLI.
It always starts with an implicit `git('.')` so it defaults to working in the

@@ -117,3 +122,3 @@ current working directory.

// Just like it's counterpart, clone is really just shorthand for git.init(); git.fetch(); git.checkout();
esgit --githubToken=$GITHUB_TOKEN clone https://github.com/wmhilton/esgit
esgit clone https://github.com/wmhilton/isomorphic-git

@@ -120,0 +125,0 @@ // Checkout a commitish

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc