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.13 to 0.0.14

14

dist/for-browserify/index.js

@@ -25,5 +25,3 @@ 'use strict';

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

@@ -215,3 +213,3 @@

depth: this.operateDepth,
remote: this.operateRemote,
remote: this.operateRemote || 'origin',
authUsername: this.operateUsername,

@@ -288,5 +286,5 @@ authPassword: this.operatePassword

gitdir: this.gitdir,
ref: 'refs/heads/' + this.operateBranch,
ref: this.operateBranch,
depth: this.operateDepth,
remote: this.operateRemote,
remote: this.operateRemote || 'origin',
authUsername: this.operateUsername,

@@ -302,3 +300,3 @@ authPassword: this.operatePassword

ref: this.operateBranch,
remote: this.operateRemote
remote: this.operateRemote || 'origin'
});

@@ -607,3 +605,3 @@

gitdir: this.gitdir,
path: 'remote.' + this.operateRemote + '.url'
path: 'remote.' + (this.operateRemote || 'origin') + '.url'
});

@@ -648,3 +646,3 @@

ref: ref,
remote: this.operateRemote,
remote: this.operateRemote || 'origin',
authUsername: this.operateUsername,

@@ -651,0 +649,0 @@ authPassword: this.operatePassword

@@ -517,8 +517,15 @@ 'use strict';

value: function () {
var _ref2 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(_ref) {
var _ref2 = _asyncToGenerator(_regeneratorRuntime.mark(function _callee(_ref /*: {
gitdir: string,
remote: string,
refs: Map<string, string>,
symrefs: Map<string, string>
} */
) {
var gitdir = _ref.gitdir,
remote = _ref.remote,
refs = _ref.refs;
refs = _ref.refs,
symrefs = _ref.symrefs;
var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _ref3, _ref4, key, value, normalizeValue, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, _ref5, _ref6, _key, _value;
var _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, _ref3, _ref4, key, value, actualRefsToWrite, _iteratorNormalCompletion2, _didIteratorError2, _iteratorError2, _iterator2, _step2, _ref5, _ref6, _key, _value, _iteratorNormalCompletion3, _didIteratorError3, _iteratorError3, _iterator3, _step3, _ref7, _ref8, _key2, _value2, branch, normalizeValue, _iteratorNormalCompletion4, _didIteratorError4, _iteratorError4, _iterator4, _step4, _ref9, _ref10, _key3, _value3;

@@ -594,7 +601,4 @@ return _regeneratorRuntime.wrap(function _callee$(_context) {

case 29:
// Update files
normalizeValue = function normalizeValue(value) {
return value.trim() + '\n';
};
// Combine refs and symrefs giving symrefs priority
actualRefsToWrite = new _Map();
_iteratorNormalCompletion2 = true;

@@ -604,6 +608,30 @@ _didIteratorError2 = false;

_context.prev = 33;
_iterator2 = _getIterator(refs);
case 35:
if (_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done) {
for (_iterator2 = _getIterator(refs); !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
_ref5 = _step2.value;
_ref6 = _slicedToArray(_ref5, 2);
_key = _ref6[0];
_value = _ref6[1];
actualRefsToWrite.set(_key, _value);
}_context.next = 41;
break;
case 37:
_context.prev = 37;
_context.t1 = _context['catch'](33);
_didIteratorError2 = true;
_iteratorError2 = _context.t1;
case 41:
_context.prev = 41;
_context.prev = 42;
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
}
case 44:
_context.prev = 44;
if (!_didIteratorError2) {
_context.next = 47;

@@ -613,53 +641,126 @@ break;

_ref5 = _step2.value;
_ref6 = _slicedToArray(_ref5, 2);
_key = _ref6[0];
_value = _ref6[1];
throw _iteratorError2;
case 47:
return _context.finish(44);
case 48:
return _context.finish(41);
case 49:
_iteratorNormalCompletion3 = true;
_didIteratorError3 = false;
_iteratorError3 = undefined;
_context.prev = 52;
for (_iterator3 = _getIterator(symrefs); !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
_ref7 = _step3.value;
_ref8 = _slicedToArray(_ref7, 2);
_key2 = _ref8[0];
_value2 = _ref8[1];
branch = _value2.replace(/^refs\/heads\//, '');
actualRefsToWrite.set(_key2, 'ref: refs/remotes/' + remote + '/' + branch);
}
// Update files
_context.next = 60;
break;
case 56:
_context.prev = 56;
_context.t2 = _context['catch'](52);
_didIteratorError3 = true;
_iteratorError3 = _context.t2;
case 60:
_context.prev = 60;
_context.prev = 61;
if (!_iteratorNormalCompletion3 && _iterator3.return) {
_iterator3.return();
}
case 63:
_context.prev = 63;
if (!_didIteratorError3) {
_context.next = 66;
break;
}
throw _iteratorError3;
case 66:
return _context.finish(63);
case 67:
return _context.finish(60);
case 68:
normalizeValue = function normalizeValue(value) {
return value.trim() + '\n';
};
_iteratorNormalCompletion4 = true;
_didIteratorError4 = false;
_iteratorError4 = undefined;
_context.prev = 72;
_iterator4 = _getIterator(actualRefsToWrite);
case 74:
if (_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done) {
_context.next = 86;
break;
}
_ref9 = _step4.value;
_ref10 = _slicedToArray(_ref9, 2);
_key3 = _ref10[0];
_value3 = _ref10[1];
// For some reason we trim these
_key = _key.replace(/^refs\/heads\//, '');
_key = _key.replace(/^refs\/tags\//, '');
_context.next = 44;
return utils_js.write(path.join(gitdir, 'refs', 'remotes', remote, _key), normalizeValue(_value), 'utf8');
_key3 = _key3.replace(/^refs\/heads\//, '');
_key3 = _key3.replace(/^refs\/tags\//, '');
_context.next = 83;
return utils_js.write(path.join(gitdir, 'refs', 'remotes', remote, _key3), normalizeValue(_value3), 'utf8');
case 44:
_iteratorNormalCompletion2 = true;
_context.next = 35;
case 83:
_iteratorNormalCompletion4 = true;
_context.next = 74;
break;
case 47:
_context.next = 53;
case 86:
_context.next = 92;
break;
case 49:
_context.prev = 49;
_context.t1 = _context['catch'](33);
_didIteratorError2 = true;
_iteratorError2 = _context.t1;
case 88:
_context.prev = 88;
_context.t3 = _context['catch'](72);
_didIteratorError4 = true;
_iteratorError4 = _context.t3;
case 53:
_context.prev = 53;
_context.prev = 54;
case 92:
_context.prev = 92;
_context.prev = 93;
if (!_iteratorNormalCompletion2 && _iterator2.return) {
_iterator2.return();
if (!_iteratorNormalCompletion4 && _iterator4.return) {
_iterator4.return();
}
case 56:
_context.prev = 56;
case 95:
_context.prev = 95;
if (!_didIteratorError2) {
_context.next = 59;
if (!_didIteratorError4) {
_context.next = 98;
break;
}
throw _iteratorError2;
throw _iteratorError4;
case 59:
return _context.finish(56);
case 98:
return _context.finish(95);
case 60:
return _context.finish(53);
case 99:
return _context.finish(92);
case 61:
case 100:
case 'end':

@@ -669,3 +770,3 @@ return _context.stop();

}
}, _callee, this, [[3, 17, 21, 29], [22,, 24, 28], [33, 49, 53, 61], [54,, 56, 60]]);
}, _callee, this, [[3, 17, 21, 29], [22,, 24, 28], [33, 37, 41, 49], [42,, 44, 48], [52, 56, 60, 68], [61,, 63, 67], [72, 88, 92, 100], [93,, 95, 99]]);
}));

@@ -678,8 +779,3 @@

return updateRemoteRefs;
}() /*: {
gitdir: string,
remote: string,
refs: Map<string, string>
} */
}()
}]);

@@ -699,2 +795,3 @@

refs : Map<string, string>
symrefs : Map<string, string>
capabilities : Set<string>

@@ -767,3 +864,3 @@ auth : { username : string, password : string }

var headers, res, data, read$$1, lineOne, lineTwo, _lineTwo$toString$tri, _lineTwo$toString$tri2, firstRef, capabilities, _firstRef$split, _firstRef$split2, ref, name, line, _line$toString$trim$s, _line$toString$trim$s2, _ref4, _name;
var headers, res, data, read$$1, lineOne, lineTwo, _lineTwo$toString$tri, _lineTwo$toString$tri2, firstRef, capabilities, _firstRef$split, _firstRef$split2, ref, name, line, _line$toString$trim$s, _line$toString$trim$s2, _ref4, _name, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, cap, m;

@@ -776,2 +873,3 @@ return _regeneratorRuntime.wrap(function _callee3$(_context3) {

this.refs = new _Map();
this.symrefs = new _Map();
headers = {};

@@ -783,3 +881,3 @@ // headers['Accept'] = `application/x-${service}-advertisement`

}
_context3.next = 6;
_context3.next = 7;
return pify(simpleGet)({

@@ -791,7 +889,7 @@ method: 'GET',

case 6:
case 7:
res = _context3.sent;
if (!(res.statusCode !== 200)) {
_context3.next = 9;
_context3.next = 10;
break;

@@ -802,7 +900,7 @@ }

case 9:
_context3.next = 11;
case 10:
_context3.next = 12;
return pify(concat)(res);
case 11:
case 12:
data = _context3.sent;

@@ -820,3 +918,3 @@

if (!(lineOne === true)) {
_context3.next = 17;
_context3.next = 18;
break;

@@ -827,5 +925,5 @@ }

case 17:
case 18:
if (!(lineOne.toString('utf8') !== '# service=' + service + '\n')) {
_context3.next = 19;
_context3.next = 20;
break;

@@ -836,3 +934,3 @@ }

case 19:
case 20:
lineTwo = read$$1();

@@ -847,3 +945,3 @@ // skip past any flushes

if (!(lineTwo === true)) {
_context3.next = 23;
_context3.next = 24;
break;

@@ -854,3 +952,3 @@ }

case 23:
case 24:
_lineTwo$toString$tri = lineTwo.toString('utf8').trim().split('\0'), _lineTwo$toString$tri2 = _slicedToArray(_lineTwo$toString$tri, 2), firstRef = _lineTwo$toString$tri2[0], capabilities = _lineTwo$toString$tri2[1];

@@ -865,3 +963,3 @@

case 27:
case 28:

@@ -872,9 +970,9 @@

if (!(line === true)) {
_context3.next = 31;
_context3.next = 32;
break;
}
return _context3.abrupt('break', 34);
return _context3.abrupt('break', 35);
case 31:
case 32:
if (line !== null) {

@@ -885,6 +983,56 @@ _line$toString$trim$s = line.toString('utf8').trim().split(' '), _line$toString$trim$s2 = _slicedToArray(_line$toString$trim$s, 2), _ref4 = _line$toString$trim$s2[0], _name = _line$toString$trim$s2[1];

}
_context3.next = 27;
_context3.next = 28;
break;
case 34:
case 35:
// Symrefs are thrown into the "capabilities" unfortunately.
_iteratorNormalCompletion = true;
_didIteratorError = false;
_iteratorError = undefined;
_context3.prev = 38;
for (_iterator = _getIterator(this.capabilities); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
cap = _step.value;
if (cap.startsWith('symref=')) {
m = cap.match(/symref=([^:]+):(.*)/);
if (m.length === 3) {
this.symrefs.set(m[1], m[2]);
}
}
}
_context3.next = 46;
break;
case 42:
_context3.prev = 42;
_context3.t0 = _context3['catch'](38);
_didIteratorError = true;
_iteratorError = _context3.t0;
case 46:
_context3.prev = 46;
_context3.prev = 47;
if (!_iteratorNormalCompletion && _iterator.return) {
_iterator.return();
}
case 49:
_context3.prev = 49;
if (!_didIteratorError) {
_context3.next = 52;
break;
}
throw _iteratorError;
case 52:
return _context3.finish(49);
case 53:
return _context3.finish(46);
case 54:
case 'end':

@@ -894,3 +1042,3 @@ return _context3.stop();

}
}, _callee3, this);
}, _callee3, this, [[38, 42, 46, 54], [47,, 49, 53]]);
}));

@@ -897,0 +1045,0 @@

@@ -458,32 +458,23 @@ 'use strict';

case 8:
if (!(ref.length === 40)) {
_context.next = 13;
if (!(ref.length === 40 && /[0-9a-f]{40}/.test(ref))) {
_context.next = 10;
break;
}
_context.next = 11;
return exists(gitdir + '/objects/' + ref.slice(0, 2) + '/' + ref.slice(2));
case 11:
if (!_context.sent) {
_context.next = 13;
break;
}
return _context.abrupt('return', ref);
case 13:
case 10:
if (!(ref === 'HEAD' || ref === 'MERGE_HEAD')) {
_context.next = 19;
_context.next = 16;
break;
}
_context.next = 16;
_context.next = 13;
return read(gitdir + '/' + ref, { encoding: 'utf8' });
case 16:
case 13:
sha = _context.sent;
if (!sha) {
_context.next = 19;
_context.next = 16;
break;

@@ -494,16 +485,16 @@ }

case 19:
case 16:
if (!ref.startsWith('refs/')) {
_context.next = 25;
_context.next = 22;
break;
}
_context.next = 22;
_context.next = 19;
return read(gitdir + '/' + ref, { encoding: 'utf8' });
case 22:
case 19:
sha = _context.sent;
if (!sha) {
_context.next = 25;
_context.next = 22;
break;

@@ -514,11 +505,11 @@ }

case 25:
_context.next = 27;
case 22:
_context.next = 24;
return read(gitdir + '/refs/heads/' + ref, { encoding: 'utf8' });
case 27:
case 24:
sha = _context.sent;
if (!sha) {
_context.next = 30;
_context.next = 27;
break;

@@ -529,11 +520,11 @@ }

case 30:
_context.next = 32;
case 27:
_context.next = 29;
return read(gitdir + '/refs/tags/' + ref, { encoding: 'utf8' });
case 32:
case 29:
sha = _context.sent;
if (!sha) {
_context.next = 35;
_context.next = 32;
break;

@@ -544,11 +535,11 @@ }

case 35:
_context.next = 37;
case 32:
_context.next = 34;
return read(gitdir + '/refs/remotes/' + ref, { encoding: 'utf8' });
case 37:
case 34:
sha = _context.sent;
if (!sha) {
_context.next = 40;
_context.next = 37;
break;

@@ -559,6 +550,6 @@ }

case 40:
case 37:
throw new Error('Could not resolve reference ' + ref);
case 41:
case 38:
case 'end':

@@ -619,3 +610,3 @@ return _context.stop();

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

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

@@ -66,7 +66,18 @@ import path from 'path';

let oid;
try {
if (remote) {
let remoteRef;
if (ref === undefined) {
remoteRef = await resolveRef({ gitdir, ref: `${remote}/HEAD`, depth: 2 });
ref = path.basename(remoteRef);
} else {
remoteRef = `${remote}/${ref}`;
}
oid = await resolveRef({ gitdir, ref: remoteRef });
// Make the remote ref our own!
await write(`${gitdir}/refs/heads/${ref}`, oid + '\n');
} else {
if (ref === undefined) {
throw new Error('Cannot checkout ref "undefined"');
}
oid = await resolveRef({ gitdir, ref });
} catch (e) {
oid = await resolveRef({ gitdir, ref: `${remote}/${ref}` });
await write(`${gitdir}/refs/heads/${ref}`, oid + '\n');
}

@@ -285,3 +296,3 @@ let commit = await GitObjectManager.read({ gitdir, oid });

gitdir,
ref = 'HEAD',
ref,
remote,

@@ -311,5 +322,6 @@ authUsername,

remote,
refs: remoteHTTP.refs
refs: remoteHTTP.refs,
symrefs: remoteHTTP.symrefs
});
let want = remoteHTTP.refs.get(ref);
let want = await resolveRef({ gitdir, ref: `refs/remotes/${remote}/${ref}` });
// Note: I removed "ofs-delta" from the capabilities list and now

@@ -333,5 +345,3 @@ // Github uses all ref-deltas when I fetch packfiles instead of all ofs-deltas. Nice!

have = await resolveRef({ gitdir, ref });
} catch (err) {
console.log("Looks like we don't have that ref yet.");
}
} catch (err) {}
if (have) {

@@ -338,0 +348,0 @@ packstream.write(GitPktLine.encode(`have ${have}\n`));

@@ -14,5 +14,3 @@ import { add, checkout, commit, fetch, findRoot, getConfig, init, list, pack, push, remove, setConfig, status, unpack, verify } from './commands.js';

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

@@ -120,3 +118,3 @@ workdir(dir) {

depth: this.operateDepth,
remote: this.operateRemote,
remote: this.operateRemote || 'origin',
authUsername: this.operateUsername,

@@ -145,5 +143,5 @@ authPassword: this.operatePassword

gitdir: this.gitdir,
ref: `refs/heads/${this.operateBranch}`,
ref: this.operateBranch,
depth: this.operateDepth,
remote: this.operateRemote,
remote: this.operateRemote || 'origin',
authUsername: this.operateUsername,

@@ -157,3 +155,3 @@ authPassword: this.operatePassword

ref: this.operateBranch,
remote: this.operateRemote
remote: this.operateRemote || 'origin'
});

@@ -221,3 +219,3 @@ }

gitdir: this.gitdir,
path: `remote.${this.operateRemote}.url`
path: `remote.${this.operateRemote || 'origin'}.url`
});

@@ -237,3 +235,3 @@ console.log('url =', url);

ref,
remote: this.operateRemote,
remote: this.operateRemote || 'origin',
authUsername: this.operateUsername,

@@ -240,0 +238,0 @@ authPassword: this.operatePassword

@@ -156,3 +156,13 @@ import { GitConfig, GitIndex, GitPktLine } from './models.js';

class GitRefsManager {
static async updateRemoteRefs({ gitdir, remote, refs }) {
static async updateRemoteRefs({
gitdir,
remote,
refs,
symrefs /*: {
gitdir: string,
remote: string,
refs: Map<string, string>,
symrefs: Map<string, string>
} */
}) {
// Validate input

@@ -164,5 +174,12 @@ for (let [key, value] of refs) {

}
// Combine refs and symrefs giving symrefs priority
let actualRefsToWrite = new Map();
for (let [key, value] of refs) actualRefsToWrite.set(key, value);
for (let [key, value] of symrefs) {
let branch = value.replace(/^refs\/heads\//, '');
actualRefsToWrite.set(key, `ref: refs/remotes/${remote}/${branch}`);
}
// Update files
const normalizeValue = value => value.trim() + '\n';
for (let [key, value] of refs) {
for (let [key, value] of actualRefsToWrite) {
// For some reason we trim these

@@ -173,7 +190,3 @@ key = key.replace(/^refs\/heads\//, '');

}
} /*: {
gitdir: string,
remote: string,
refs: Map<string, string>
} */
}
}

@@ -190,2 +203,3 @@

refs : Map<string, string>
symrefs : Map<string, string>
capabilities : Set<string>

@@ -208,2 +222,3 @@ auth : { username : string, password : string }

this.refs = new Map();
this.symrefs = new Map();
let headers = {};

@@ -251,2 +266,11 @@ // headers['Accept'] = `application/x-${service}-advertisement`

}
// Symrefs are thrown into the "capabilities" unfortunately.
for (let cap of this.capabilities) {
if (cap.startsWith('symref=')) {
let m = cap.match(/symref=([^:]+):(.*)/);
if (m.length === 3) {
this.symrefs.set(m[1], m[2]);
}
}
}
}

@@ -253,0 +277,0 @@ async push(stream$$1 /*: ReadableStream */) {

@@ -173,6 +173,4 @@ import systemfs from 'fs';

// Is it a complete and valid SHA?
if (ref.length === 40) {
if (await exists(`${gitdir}/objects/${ref.slice(0, 2)}/${ref.slice(2)}`)) {
return ref;
}
if (ref.length === 40 && /[0-9a-f]{40}/.test(ref)) {
return ref;
}

@@ -219,3 +217,3 @@ // Is it a special ref?

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

@@ -222,0 +220,0 @@ var main = "dist/for-node/";

@@ -72,7 +72,18 @@ 'use strict';

let oid;
try {
if (remote) {
let remoteRef;
if (ref === undefined) {
remoteRef = await utils_js.resolveRef({ gitdir, ref: `${remote}/HEAD`, depth: 2 });
ref = path.basename(remoteRef);
} else {
remoteRef = `${remote}/${ref}`;
}
oid = await utils_js.resolveRef({ gitdir, ref: remoteRef });
// Make the remote ref our own!
await utils_js.write(`${gitdir}/refs/heads/${ref}`, oid + '\n');
} else {
if (ref === undefined) {
throw new Error('Cannot checkout ref "undefined"');
}
oid = await utils_js.resolveRef({ gitdir, ref });
} catch (e) {
oid = await utils_js.resolveRef({ gitdir, ref: `${remote}/${ref}` });
await utils_js.write(`${gitdir}/refs/heads/${ref}`, oid + '\n');
}

@@ -291,3 +302,3 @@ let commit = await managers_js.GitObjectManager.read({ gitdir, oid });

gitdir,
ref = 'HEAD',
ref,
remote,

@@ -317,5 +328,6 @@ authUsername,

remote,
refs: remoteHTTP.refs
refs: remoteHTTP.refs,
symrefs: remoteHTTP.symrefs
});
let want = remoteHTTP.refs.get(ref);
let want = await utils_js.resolveRef({ gitdir, ref: `refs/remotes/${remote}/${ref}` });
// Note: I removed "ofs-delta" from the capabilities list and now

@@ -339,5 +351,3 @@ // Github uses all ref-deltas when I fetch packfiles instead of all ofs-deltas. Nice!

have = await utils_js.resolveRef({ gitdir, ref });
} catch (err) {
console.log("Looks like we don't have that ref yet.");
}
} catch (err) {}
if (have) {

@@ -344,0 +354,0 @@ packstream.write(models_js.GitPktLine.encode(`have ${have}\n`));

@@ -16,5 +16,3 @@ 'use strict';

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

@@ -122,3 +120,3 @@ workdir(dir) {

depth: this.operateDepth,
remote: this.operateRemote,
remote: this.operateRemote || 'origin',
authUsername: this.operateUsername,

@@ -147,5 +145,5 @@ authPassword: this.operatePassword

gitdir: this.gitdir,
ref: `refs/heads/${this.operateBranch}`,
ref: this.operateBranch,
depth: this.operateDepth,
remote: this.operateRemote,
remote: this.operateRemote || 'origin',
authUsername: this.operateUsername,

@@ -159,3 +157,3 @@ authPassword: this.operatePassword

ref: this.operateBranch,
remote: this.operateRemote
remote: this.operateRemote || 'origin'
});

@@ -223,3 +221,3 @@ }

gitdir: this.gitdir,
path: `remote.${this.operateRemote}.url`
path: `remote.${this.operateRemote || 'origin'}.url`
});

@@ -239,3 +237,3 @@ console.log('url =', url);

ref,
remote: this.operateRemote,
remote: this.operateRemote || 'origin',
authUsername: this.operateUsername,

@@ -242,0 +240,0 @@ authPassword: this.operatePassword

@@ -162,3 +162,13 @@ 'use strict';

class GitRefsManager {
static async updateRemoteRefs({ gitdir, remote, refs }) {
static async updateRemoteRefs({
gitdir,
remote,
refs,
symrefs /*: {
gitdir: string,
remote: string,
refs: Map<string, string>,
symrefs: Map<string, string>
} */
}) {
// Validate input

@@ -170,5 +180,12 @@ for (let [key, value] of refs) {

}
// Combine refs and symrefs giving symrefs priority
let actualRefsToWrite = new Map();
for (let [key, value] of refs) actualRefsToWrite.set(key, value);
for (let [key, value] of symrefs) {
let branch = value.replace(/^refs\/heads\//, '');
actualRefsToWrite.set(key, `ref: refs/remotes/${remote}/${branch}`);
}
// Update files
const normalizeValue = value => value.trim() + '\n';
for (let [key, value] of refs) {
for (let [key, value] of actualRefsToWrite) {
// For some reason we trim these

@@ -179,7 +196,3 @@ key = key.replace(/^refs\/heads\//, '');

}
} /*: {
gitdir: string,
remote: string,
refs: Map<string, string>
} */
}
}

@@ -196,2 +209,3 @@

refs : Map<string, string>
symrefs : Map<string, string>
capabilities : Set<string>

@@ -214,2 +228,3 @@ auth : { username : string, password : string }

this.refs = new Map();
this.symrefs = new Map();
let headers = {};

@@ -257,2 +272,11 @@ // headers['Accept'] = `application/x-${service}-advertisement`

}
// Symrefs are thrown into the "capabilities" unfortunately.
for (let cap of this.capabilities) {
if (cap.startsWith('symref=')) {
let m = cap.match(/symref=([^:]+):(.*)/);
if (m.length === 3) {
this.symrefs.set(m[1], m[2]);
}
}
}
}

@@ -259,0 +283,0 @@ async push(stream$$1 /*: ReadableStream */) {

@@ -179,6 +179,4 @@ 'use strict';

// Is it a complete and valid SHA?
if (ref.length === 40) {
if (await exists(`${gitdir}/objects/${ref.slice(0, 2)}/${ref.slice(2)}`)) {
return ref;
}
if (ref.length === 40 && /[0-9a-f]{40}/.test(ref)) {
return ref;
}

@@ -225,3 +223,3 @@ // Is it a special ref?

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

@@ -228,0 +226,0 @@ var main = "dist/for-node/";

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

@@ -5,0 +5,0 @@ "main": "dist/for-node/",

@@ -55,3 +55,2 @@ # 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)

.depth(1)
.branch('master')
.clone('https://cors-buster-jfpactjnem.now.sh/github.com/wmhilton/isomorphic-git')

@@ -70,3 +69,3 @@

.depth(1)
.fetch('refs/heads/master')
.fetch('master')

@@ -73,0 +72,0 @@ // Checkout a commitish

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

Sorry, the diff of this file is not supported yet

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

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

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