isomorphic-git 1.7.0 β 1.7.4
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/README.md +4 -0
- package/browser-tests.json +3 -3
- package/index.cjs +99 -5
- package/index.js +99 -5
- package/index.umd.min.js +2 -2
- package/index.umd.min.js.map +1 -1
- package/package.json +8 -4
- package/size_report.html +1 -1
package/README.md
CHANGED
|
@@ -321,6 +321,10 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
|
|
|
321
321
|
<td align="center"><a href="http://eaf4.com"><img src="https://avatars0.githubusercontent.com/u/319282?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Edward Faulkner</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ef4" title="Code">π»</a></td>
|
|
322
322
|
<td align="center"><a href="https://github.com/KSXGitHub"><img src="https://avatars2.githubusercontent.com/u/11488886?v=4?s=60" width="60px;" alt=""/><br /><sub><b>KhαΊ£i</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/issues?q=author%3AKSXGitHub" title="Bug reports">π</a></td>
|
|
323
323
|
<td align="center"><a href="https://crutchcorn.dev/"><img src="https://avatars0.githubusercontent.com/u/9100169?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Corbin Crutchley</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=crutchcorn" title="Code">π»</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=crutchcorn" title="Documentation">π</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=crutchcorn" title="Tests">β οΈ</a></td>
|
|
324
|
+
<td align="center"><a href="https://onetwo.ren/"><img src="https://avatars1.githubusercontent.com/u/3746270?v=4?s=60" width="60px;" alt=""/><br /><sub><b>lin onetwo</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=linonetwo" title="Code">π»</a></td>
|
|
325
|
+
</tr>
|
|
326
|
+
<tr>
|
|
327
|
+
<td align="center"><a href="https://github.com/linfaxin"><img src="https://avatars2.githubusercontent.com/u/3705017?v=4?s=60" width="60px;" alt=""/><br /><sub><b>ζζ³ι«</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/issues?q=author%3Alinfaxin" title="Bug reports">π</a></td>
|
|
324
328
|
</tr>
|
|
325
329
|
</table>
|
|
326
330
|
|
package/browser-tests.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
[
|
|
2
2
|
"HeadlessChrome 0.0.0 (Linux 0.0.0)",
|
|
3
|
-
"Firefox
|
|
4
|
-
"Chrome Mobile
|
|
5
|
-
"Chrome 79.0.3945 (Windows 10 0.0.0)",
|
|
3
|
+
"Firefox 78.0.0 (Ubuntu 0.0.0)",
|
|
4
|
+
"Chrome Mobile 83.0.4103 (Android 0.0.0)",
|
|
6
5
|
"Safari 13.1.0 (Mac OS X 10.15.4)",
|
|
6
|
+
"Chrome 79.0.3945 (Windows 10 0.0.0)",
|
|
7
7
|
"Mobile Safari 13.0.0 (iOS 13.0.0)"
|
|
8
8
|
]
|
package/index.cjs
CHANGED
|
@@ -7,7 +7,6 @@ function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'defau
|
|
|
7
7
|
var AsyncLock = _interopDefault(require('async-lock'));
|
|
8
8
|
var Hash = _interopDefault(require('sha.js/sha1.js'));
|
|
9
9
|
var crc32 = _interopDefault(require('crc-32'));
|
|
10
|
-
var applyDelta = _interopDefault(require('git-apply-delta'));
|
|
11
10
|
var pako = _interopDefault(require('pako'));
|
|
12
11
|
var ignore = _interopDefault(require('ignore'));
|
|
13
12
|
var pify = _interopDefault(require('pify'));
|
|
@@ -382,6 +381,12 @@ class BufferCursor {
|
|
|
382
381
|
return r
|
|
383
382
|
}
|
|
384
383
|
|
|
384
|
+
copy(source, start, end) {
|
|
385
|
+
const r = source.copy(this.buffer, this._start, start, end);
|
|
386
|
+
this._start += r;
|
|
387
|
+
return r
|
|
388
|
+
}
|
|
389
|
+
|
|
385
390
|
readUInt8() {
|
|
386
391
|
const r = this.buffer.readUInt8(this._start);
|
|
387
392
|
this._start += 1;
|
|
@@ -2103,6 +2108,91 @@ async function readObjectLoose({ fs, gitdir, oid }) {
|
|
|
2103
2108
|
return { object: file, format: 'deflated', source }
|
|
2104
2109
|
}
|
|
2105
2110
|
|
|
2111
|
+
/**
|
|
2112
|
+
* @param {Buffer} delta
|
|
2113
|
+
* @param {Buffer} source
|
|
2114
|
+
* @returns {Buffer}
|
|
2115
|
+
*/
|
|
2116
|
+
function applyDelta(delta, source) {
|
|
2117
|
+
const reader = new BufferCursor(delta);
|
|
2118
|
+
const sourceSize = readVarIntLE(reader);
|
|
2119
|
+
|
|
2120
|
+
if (sourceSize !== source.byteLength) {
|
|
2121
|
+
throw new InternalError(
|
|
2122
|
+
`applyDelta expected source buffer to be ${sourceSize} bytes but the provided buffer was ${source.length} bytes`
|
|
2123
|
+
)
|
|
2124
|
+
}
|
|
2125
|
+
const targetSize = readVarIntLE(reader);
|
|
2126
|
+
let target;
|
|
2127
|
+
|
|
2128
|
+
const firstOp = readOp(reader, source);
|
|
2129
|
+
// Speed optimization - return raw buffer if it's just single simple copy
|
|
2130
|
+
if (firstOp.byteLength === targetSize) {
|
|
2131
|
+
target = firstOp;
|
|
2132
|
+
} else {
|
|
2133
|
+
// Otherwise, allocate a fresh buffer and slices
|
|
2134
|
+
target = Buffer.alloc(targetSize);
|
|
2135
|
+
const writer = new BufferCursor(target);
|
|
2136
|
+
writer.copy(firstOp);
|
|
2137
|
+
|
|
2138
|
+
while (!reader.eof()) {
|
|
2139
|
+
writer.copy(readOp(reader, source));
|
|
2140
|
+
}
|
|
2141
|
+
|
|
2142
|
+
const tell = writer.tell();
|
|
2143
|
+
if (targetSize !== tell) {
|
|
2144
|
+
throw new InternalError(
|
|
2145
|
+
`applyDelta expected target buffer to be ${targetSize} bytes but the resulting buffer was ${tell} bytes`
|
|
2146
|
+
)
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
return target
|
|
2150
|
+
}
|
|
2151
|
+
|
|
2152
|
+
function readVarIntLE(reader) {
|
|
2153
|
+
let result = 0;
|
|
2154
|
+
let shift = 0;
|
|
2155
|
+
let byte = null;
|
|
2156
|
+
do {
|
|
2157
|
+
byte = reader.readUInt8();
|
|
2158
|
+
result |= (byte & 0b01111111) << shift;
|
|
2159
|
+
shift += 7;
|
|
2160
|
+
} while (byte & 0b10000000)
|
|
2161
|
+
return result
|
|
2162
|
+
}
|
|
2163
|
+
|
|
2164
|
+
function readCompactLE(reader, flags, size) {
|
|
2165
|
+
let result = 0;
|
|
2166
|
+
let shift = 0;
|
|
2167
|
+
while (size--) {
|
|
2168
|
+
if (flags & 0b00000001) {
|
|
2169
|
+
result |= reader.readUInt8() << shift;
|
|
2170
|
+
}
|
|
2171
|
+
flags >>= 1;
|
|
2172
|
+
shift += 8;
|
|
2173
|
+
}
|
|
2174
|
+
return result
|
|
2175
|
+
}
|
|
2176
|
+
|
|
2177
|
+
function readOp(reader, source) {
|
|
2178
|
+
/** @type {number} */
|
|
2179
|
+
const byte = reader.readUInt8();
|
|
2180
|
+
const COPY = 0b10000000;
|
|
2181
|
+
const OFFS = 0b00001111;
|
|
2182
|
+
const SIZE = 0b01110000;
|
|
2183
|
+
if (byte & COPY) {
|
|
2184
|
+
// copy consists of 4 byte offset, 3 byte size (in LE order)
|
|
2185
|
+
const offset = readCompactLE(reader, byte & OFFS, 4);
|
|
2186
|
+
let size = readCompactLE(reader, (byte & SIZE) >> 4, 3);
|
|
2187
|
+
// Yup. They really did this optimization.
|
|
2188
|
+
if (size === 0) size = 0x10000;
|
|
2189
|
+
return source.slice(offset, offset + size)
|
|
2190
|
+
} else {
|
|
2191
|
+
// insert
|
|
2192
|
+
return reader.slice(byte)
|
|
2193
|
+
}
|
|
2194
|
+
}
|
|
2195
|
+
|
|
2106
2196
|
// Convert a value to an Async Iterator
|
|
2107
2197
|
// This will be easier with async generator functions.
|
|
2108
2198
|
function fromValue(value) {
|
|
@@ -6610,8 +6700,8 @@ function filterCapabilities(server, client) {
|
|
|
6610
6700
|
|
|
6611
6701
|
const pkg = {
|
|
6612
6702
|
name: 'isomorphic-git',
|
|
6613
|
-
version: '1.7.
|
|
6614
|
-
agent: 'git/isomorphic-git@1.7.
|
|
6703
|
+
version: '1.7.4',
|
|
6704
|
+
agent: 'git/isomorphic-git@1.7.4',
|
|
6615
6705
|
};
|
|
6616
6706
|
|
|
6617
6707
|
class FIFO {
|
|
@@ -8555,6 +8645,7 @@ async function _pull({
|
|
|
8555
8645
|
// Merge the remote tracking branch into the local one.
|
|
8556
8646
|
await _merge({
|
|
8557
8647
|
fs,
|
|
8648
|
+
cache,
|
|
8558
8649
|
gitdir,
|
|
8559
8650
|
ours: ref,
|
|
8560
8651
|
theirs: fetchHead,
|
|
@@ -9043,6 +9134,7 @@ async function getRemoteInfo({
|
|
|
9043
9134
|
assertParameter('http', http);
|
|
9044
9135
|
assertParameter('url', url);
|
|
9045
9136
|
|
|
9137
|
+
const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url });
|
|
9046
9138
|
const remote = await GitRemoteHTTP.discover({
|
|
9047
9139
|
http,
|
|
9048
9140
|
onAuth,
|
|
@@ -9193,6 +9285,7 @@ async function getRemoteInfo2({
|
|
|
9193
9285
|
assertParameter('http', http);
|
|
9194
9286
|
assertParameter('url', url);
|
|
9195
9287
|
|
|
9288
|
+
const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url });
|
|
9196
9289
|
const remote = await GitRemoteHTTP.discover({
|
|
9197
9290
|
http,
|
|
9198
9291
|
onAuth,
|
|
@@ -10701,8 +10794,9 @@ async function listObjects({
|
|
|
10701
10794
|
} else if (type === 'tree') {
|
|
10702
10795
|
const tree = GitTree.from(object);
|
|
10703
10796
|
for (const entry of tree) {
|
|
10704
|
-
// add blobs
|
|
10705
|
-
|
|
10797
|
+
// add blobs to the set
|
|
10798
|
+
// skip over submodules whose type is 'commit'
|
|
10799
|
+
if (entry.type === 'blob') {
|
|
10706
10800
|
visited.add(entry.oid);
|
|
10707
10801
|
}
|
|
10708
10802
|
// recurse for trees
|
package/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import AsyncLock from 'async-lock';
|
|
2
2
|
import Hash from 'sha.js/sha1.js';
|
|
3
3
|
import crc32 from 'crc-32';
|
|
4
|
-
import applyDelta from 'git-apply-delta';
|
|
5
4
|
import pako from 'pako';
|
|
6
5
|
import ignore from 'ignore';
|
|
7
6
|
import pify from 'pify';
|
|
@@ -376,6 +375,12 @@ class BufferCursor {
|
|
|
376
375
|
return r
|
|
377
376
|
}
|
|
378
377
|
|
|
378
|
+
copy(source, start, end) {
|
|
379
|
+
const r = source.copy(this.buffer, this._start, start, end);
|
|
380
|
+
this._start += r;
|
|
381
|
+
return r
|
|
382
|
+
}
|
|
383
|
+
|
|
379
384
|
readUInt8() {
|
|
380
385
|
const r = this.buffer.readUInt8(this._start);
|
|
381
386
|
this._start += 1;
|
|
@@ -2097,6 +2102,91 @@ async function readObjectLoose({ fs, gitdir, oid }) {
|
|
|
2097
2102
|
return { object: file, format: 'deflated', source }
|
|
2098
2103
|
}
|
|
2099
2104
|
|
|
2105
|
+
/**
|
|
2106
|
+
* @param {Buffer} delta
|
|
2107
|
+
* @param {Buffer} source
|
|
2108
|
+
* @returns {Buffer}
|
|
2109
|
+
*/
|
|
2110
|
+
function applyDelta(delta, source) {
|
|
2111
|
+
const reader = new BufferCursor(delta);
|
|
2112
|
+
const sourceSize = readVarIntLE(reader);
|
|
2113
|
+
|
|
2114
|
+
if (sourceSize !== source.byteLength) {
|
|
2115
|
+
throw new InternalError(
|
|
2116
|
+
`applyDelta expected source buffer to be ${sourceSize} bytes but the provided buffer was ${source.length} bytes`
|
|
2117
|
+
)
|
|
2118
|
+
}
|
|
2119
|
+
const targetSize = readVarIntLE(reader);
|
|
2120
|
+
let target;
|
|
2121
|
+
|
|
2122
|
+
const firstOp = readOp(reader, source);
|
|
2123
|
+
// Speed optimization - return raw buffer if it's just single simple copy
|
|
2124
|
+
if (firstOp.byteLength === targetSize) {
|
|
2125
|
+
target = firstOp;
|
|
2126
|
+
} else {
|
|
2127
|
+
// Otherwise, allocate a fresh buffer and slices
|
|
2128
|
+
target = Buffer.alloc(targetSize);
|
|
2129
|
+
const writer = new BufferCursor(target);
|
|
2130
|
+
writer.copy(firstOp);
|
|
2131
|
+
|
|
2132
|
+
while (!reader.eof()) {
|
|
2133
|
+
writer.copy(readOp(reader, source));
|
|
2134
|
+
}
|
|
2135
|
+
|
|
2136
|
+
const tell = writer.tell();
|
|
2137
|
+
if (targetSize !== tell) {
|
|
2138
|
+
throw new InternalError(
|
|
2139
|
+
`applyDelta expected target buffer to be ${targetSize} bytes but the resulting buffer was ${tell} bytes`
|
|
2140
|
+
)
|
|
2141
|
+
}
|
|
2142
|
+
}
|
|
2143
|
+
return target
|
|
2144
|
+
}
|
|
2145
|
+
|
|
2146
|
+
function readVarIntLE(reader) {
|
|
2147
|
+
let result = 0;
|
|
2148
|
+
let shift = 0;
|
|
2149
|
+
let byte = null;
|
|
2150
|
+
do {
|
|
2151
|
+
byte = reader.readUInt8();
|
|
2152
|
+
result |= (byte & 0b01111111) << shift;
|
|
2153
|
+
shift += 7;
|
|
2154
|
+
} while (byte & 0b10000000)
|
|
2155
|
+
return result
|
|
2156
|
+
}
|
|
2157
|
+
|
|
2158
|
+
function readCompactLE(reader, flags, size) {
|
|
2159
|
+
let result = 0;
|
|
2160
|
+
let shift = 0;
|
|
2161
|
+
while (size--) {
|
|
2162
|
+
if (flags & 0b00000001) {
|
|
2163
|
+
result |= reader.readUInt8() << shift;
|
|
2164
|
+
}
|
|
2165
|
+
flags >>= 1;
|
|
2166
|
+
shift += 8;
|
|
2167
|
+
}
|
|
2168
|
+
return result
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
function readOp(reader, source) {
|
|
2172
|
+
/** @type {number} */
|
|
2173
|
+
const byte = reader.readUInt8();
|
|
2174
|
+
const COPY = 0b10000000;
|
|
2175
|
+
const OFFS = 0b00001111;
|
|
2176
|
+
const SIZE = 0b01110000;
|
|
2177
|
+
if (byte & COPY) {
|
|
2178
|
+
// copy consists of 4 byte offset, 3 byte size (in LE order)
|
|
2179
|
+
const offset = readCompactLE(reader, byte & OFFS, 4);
|
|
2180
|
+
let size = readCompactLE(reader, (byte & SIZE) >> 4, 3);
|
|
2181
|
+
// Yup. They really did this optimization.
|
|
2182
|
+
if (size === 0) size = 0x10000;
|
|
2183
|
+
return source.slice(offset, offset + size)
|
|
2184
|
+
} else {
|
|
2185
|
+
// insert
|
|
2186
|
+
return reader.slice(byte)
|
|
2187
|
+
}
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2100
2190
|
// Convert a value to an Async Iterator
|
|
2101
2191
|
// This will be easier with async generator functions.
|
|
2102
2192
|
function fromValue(value) {
|
|
@@ -6604,8 +6694,8 @@ function filterCapabilities(server, client) {
|
|
|
6604
6694
|
|
|
6605
6695
|
const pkg = {
|
|
6606
6696
|
name: 'isomorphic-git',
|
|
6607
|
-
version: '1.7.
|
|
6608
|
-
agent: 'git/isomorphic-git@1.7.
|
|
6697
|
+
version: '1.7.4',
|
|
6698
|
+
agent: 'git/isomorphic-git@1.7.4',
|
|
6609
6699
|
};
|
|
6610
6700
|
|
|
6611
6701
|
class FIFO {
|
|
@@ -8549,6 +8639,7 @@ async function _pull({
|
|
|
8549
8639
|
// Merge the remote tracking branch into the local one.
|
|
8550
8640
|
await _merge({
|
|
8551
8641
|
fs,
|
|
8642
|
+
cache,
|
|
8552
8643
|
gitdir,
|
|
8553
8644
|
ours: ref,
|
|
8554
8645
|
theirs: fetchHead,
|
|
@@ -9037,6 +9128,7 @@ async function getRemoteInfo({
|
|
|
9037
9128
|
assertParameter('http', http);
|
|
9038
9129
|
assertParameter('url', url);
|
|
9039
9130
|
|
|
9131
|
+
const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url });
|
|
9040
9132
|
const remote = await GitRemoteHTTP.discover({
|
|
9041
9133
|
http,
|
|
9042
9134
|
onAuth,
|
|
@@ -9187,6 +9279,7 @@ async function getRemoteInfo2({
|
|
|
9187
9279
|
assertParameter('http', http);
|
|
9188
9280
|
assertParameter('url', url);
|
|
9189
9281
|
|
|
9282
|
+
const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url });
|
|
9190
9283
|
const remote = await GitRemoteHTTP.discover({
|
|
9191
9284
|
http,
|
|
9192
9285
|
onAuth,
|
|
@@ -10695,8 +10788,9 @@ async function listObjects({
|
|
|
10695
10788
|
} else if (type === 'tree') {
|
|
10696
10789
|
const tree = GitTree.from(object);
|
|
10697
10790
|
for (const entry of tree) {
|
|
10698
|
-
// add blobs
|
|
10699
|
-
|
|
10791
|
+
// add blobs to the set
|
|
10792
|
+
// skip over submodules whose type is 'commit'
|
|
10793
|
+
if (entry.type === 'blob') {
|
|
10700
10794
|
visited.add(entry.oid);
|
|
10701
10795
|
}
|
|
10702
10796
|
// recurse for trees
|