isomorphic-git 1.30.2 → 1.31.0
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 -1
- package/browser-tests.json +7 -4
- package/index.cjs +232 -73
- package/index.d.ts +13 -4
- package/index.js +232 -73
- package/index.umd.min.d.ts +13 -4
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/package.json +1 -1
- package/size_report.html +1 -1
package/README.md
CHANGED
|
@@ -111,7 +111,8 @@ Then check out the [Useful Snippets](https://isomorphic-git.org/docs/en/snippets
|
|
|
111
111
|
|
|
112
112
|
Unfortunately, due to the same-origin policy by default `isomorphic-git` can only clone from the same origin as the webpage it is running on. This is terribly inconvenient, as it means for all practical purposes cloning and pushing repos must be done through a proxy.
|
|
113
113
|
|
|
114
|
-
For this purpose [@isomorphic-git/cors-proxy](https://github.com/isomorphic-git/cors-proxy) exists which you can clone or [`npm install`](https://www.npmjs.com/package/@isomorphic-git/cors-proxy).
|
|
114
|
+
For this purpose, [@isomorphic-git/cors-proxy](https://github.com/isomorphic-git/cors-proxy) exists; which you can clone it or [`npm install`](https://www.npmjs.com/package/@isomorphic-git/cors-proxy) it. Alternatively, use CloudFlare workers, which can be setup without leaving the browser ([instructions](https://gist.github.com/tomlarkworthy/cf1d4ceabeabdb6d1628575ab3a83acf)).
|
|
115
|
+
|
|
115
116
|
For testing or small projects, you can also use [https://cors.isomorphic-git.org](https://cors.isomorphic-git.org) - a free proxy sponsored by [Clever Cloud](https://www.clever-cloud.com/?utm_source=ref&utm_medium=link&utm_campaign=isomorphic-git).
|
|
116
117
|
|
|
117
118
|
We hope to get CORS headers added to all the major Git hosting platforms eventually, and will list the progress made here:
|
|
@@ -385,7 +386,9 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
|
|
|
385
386
|
</tr>
|
|
386
387
|
<tr>
|
|
387
388
|
<td align="center"><a href="https://github.com/lukecotter"><img src="https://avatars.githubusercontent.com/u/4013877?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Luke Cotter</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=lukecotter" title="Code">💻</a></td>
|
|
389
|
+
<td align="center"><a href="https://tomlarkworthy.endpointservices.net/"><img src="https://avatars.githubusercontent.com/u/1848162?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Tom Larkworthy</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=tomlarkworthy" title="Documentation">📖</a></td>
|
|
388
390
|
<td align="center"><a href="https://github.com/kofta999"><img src="https://avatars.githubusercontent.com/u/99273340?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Mostafa Mahmoud</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=kofta999" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=kofta999" title="Tests">⚠️</a> <a href="#question-kofta999" title="Answering Questions">💬</a></td>
|
|
391
|
+
<td align="center"><a href="https://github.com/ARBhosale"><img src="https://avatars.githubusercontent.com/u/26981417?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Aniket Bhosale</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ARBhosale" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ARBhosale" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ARBhosale" title="Tests">⚠️</a></td>
|
|
389
392
|
</tr>
|
|
390
393
|
</table>
|
|
391
394
|
|
package/browser-tests.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
[
|
|
2
|
-
"Chrome Headless 79.0.3945.0 (Linux x86_64)",
|
|
3
|
-
"Firefox
|
|
4
|
-
"Chrome 135.0.0.0 (Android 10)",
|
|
2
|
+
"X Chrome Headless 79.0.3945.0 (Linux x86_64)",
|
|
3
|
+
"X Firefox 139.0 (Linux x86_64)",
|
|
5
4
|
"Edge 79.0.309.65 (Windows 10)",
|
|
5
|
+
"Chrome 135.0.0.0 (Android 10)",
|
|
6
|
+
"Safari 14.1 (Mac OS 10.15.7)",
|
|
6
7
|
"Mobile Safari 14.0 (iOS 14.0.1)",
|
|
7
|
-
"
|
|
8
|
+
"Chrome Headless 79.0.3945.0 (Linux x86_64)",
|
|
9
|
+
"Firefox 139.0 (Linux x86_64)",
|
|
10
|
+
"Chrome 135.0.0.0 (Android 10)"
|
|
8
11
|
]
|
package/index.cjs
CHANGED
|
@@ -6291,6 +6291,8 @@ const worthWalking = (filepath, root) => {
|
|
|
6291
6291
|
* @param {boolean} [args.dryRun]
|
|
6292
6292
|
* @param {boolean} [args.force]
|
|
6293
6293
|
* @param {boolean} [args.track]
|
|
6294
|
+
* @param {boolean} [args.nonBlocking]
|
|
6295
|
+
* @param {number} [args.batchSize]
|
|
6294
6296
|
*
|
|
6295
6297
|
* @returns {Promise<void>} Resolves successfully when filesystem operations are complete
|
|
6296
6298
|
*
|
|
@@ -6310,6 +6312,8 @@ async function _checkout({
|
|
|
6310
6312
|
dryRun,
|
|
6311
6313
|
force,
|
|
6312
6314
|
track = true,
|
|
6315
|
+
nonBlocking = false,
|
|
6316
|
+
batchSize = 100,
|
|
6313
6317
|
}) {
|
|
6314
6318
|
// oldOid is defined only if onPostCheckout hook is attached
|
|
6315
6319
|
let oldOid;
|
|
@@ -6482,72 +6486,122 @@ async function _checkout({
|
|
|
6482
6486
|
})
|
|
6483
6487
|
);
|
|
6484
6488
|
|
|
6485
|
-
|
|
6486
|
-
|
|
6487
|
-
|
|
6488
|
-
|
|
6489
|
-
|
|
6490
|
-
|
|
6491
|
-
|
|
6492
|
-
|
|
6493
|
-
|
|
6494
|
-
)
|
|
6495
|
-
.map(async function([method, fullpath, oid, mode, chmod]) {
|
|
6496
|
-
const filepath = `${dir}/${fullpath}`;
|
|
6497
|
-
try {
|
|
6498
|
-
if (method !== 'create-index' && method !== 'mkdir-index') {
|
|
6499
|
-
const { object } = await _readObject({ fs, cache, gitdir, oid });
|
|
6500
|
-
if (chmod) {
|
|
6501
|
-
// Note: the mode option of fs.write only works when creating files,
|
|
6502
|
-
// not updating them. Since the `fs` plugin doesn't expose `chmod` this
|
|
6503
|
-
// is our only option.
|
|
6504
|
-
await fs.rm(filepath);
|
|
6505
|
-
}
|
|
6506
|
-
if (mode === 0o100644) {
|
|
6507
|
-
// regular file
|
|
6508
|
-
await fs.write(filepath, object);
|
|
6509
|
-
} else if (mode === 0o100755) {
|
|
6510
|
-
// executable file
|
|
6511
|
-
await fs.write(filepath, object, { mode: 0o777 });
|
|
6512
|
-
} else if (mode === 0o120000) {
|
|
6513
|
-
// symlink
|
|
6514
|
-
await fs.writelink(filepath, object);
|
|
6515
|
-
} else {
|
|
6516
|
-
throw new InternalError(
|
|
6517
|
-
`Invalid mode 0o${mode.toString(8)} detected in blob ${oid}`
|
|
6518
|
-
)
|
|
6519
|
-
}
|
|
6520
|
-
}
|
|
6489
|
+
if (nonBlocking) {
|
|
6490
|
+
// Filter eligible operations first
|
|
6491
|
+
const eligibleOps = ops.filter(
|
|
6492
|
+
([method]) =>
|
|
6493
|
+
method === 'create' ||
|
|
6494
|
+
method === 'create-index' ||
|
|
6495
|
+
method === 'update' ||
|
|
6496
|
+
method === 'mkdir-index'
|
|
6497
|
+
);
|
|
6521
6498
|
|
|
6522
|
-
|
|
6523
|
-
|
|
6524
|
-
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
|
|
6528
|
-
|
|
6529
|
-
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
|
|
6533
|
-
|
|
6534
|
-
|
|
6535
|
-
stats,
|
|
6536
|
-
oid,
|
|
6537
|
-
});
|
|
6538
|
-
if (onProgress) {
|
|
6539
|
-
await onProgress({
|
|
6540
|
-
phase: 'Updating workdir',
|
|
6541
|
-
loaded: ++count,
|
|
6542
|
-
total,
|
|
6543
|
-
});
|
|
6544
|
-
}
|
|
6545
|
-
} catch (e) {
|
|
6546
|
-
console.log(e);
|
|
6547
|
-
}
|
|
6548
|
-
})
|
|
6499
|
+
const updateWorkingDirResults = await batchAllSettled(
|
|
6500
|
+
'Update Working Dir',
|
|
6501
|
+
eligibleOps.map(([method, fullpath, oid, mode, chmod]) => () =>
|
|
6502
|
+
updateWorkingDir({ fs, cache, gitdir, dir }, [
|
|
6503
|
+
method,
|
|
6504
|
+
fullpath,
|
|
6505
|
+
oid,
|
|
6506
|
+
mode,
|
|
6507
|
+
chmod,
|
|
6508
|
+
])
|
|
6509
|
+
),
|
|
6510
|
+
onProgress,
|
|
6511
|
+
batchSize
|
|
6549
6512
|
);
|
|
6550
|
-
|
|
6513
|
+
|
|
6514
|
+
await GitIndexManager.acquire(
|
|
6515
|
+
{ fs, gitdir, cache, allowUnmerged: true },
|
|
6516
|
+
async function(index) {
|
|
6517
|
+
await batchAllSettled(
|
|
6518
|
+
'Update Index',
|
|
6519
|
+
updateWorkingDirResults.map(([fullpath, oid, stats]) => () =>
|
|
6520
|
+
updateIndex({ index, fullpath, oid, stats })
|
|
6521
|
+
),
|
|
6522
|
+
onProgress,
|
|
6523
|
+
batchSize
|
|
6524
|
+
);
|
|
6525
|
+
}
|
|
6526
|
+
);
|
|
6527
|
+
} else {
|
|
6528
|
+
await GitIndexManager.acquire(
|
|
6529
|
+
{ fs, gitdir, cache, allowUnmerged: true },
|
|
6530
|
+
async function(index) {
|
|
6531
|
+
await Promise.all(
|
|
6532
|
+
ops
|
|
6533
|
+
.filter(
|
|
6534
|
+
([method]) =>
|
|
6535
|
+
method === 'create' ||
|
|
6536
|
+
method === 'create-index' ||
|
|
6537
|
+
method === 'update' ||
|
|
6538
|
+
method === 'mkdir-index'
|
|
6539
|
+
)
|
|
6540
|
+
.map(async function([method, fullpath, oid, mode, chmod]) {
|
|
6541
|
+
const filepath = `${dir}/${fullpath}`;
|
|
6542
|
+
try {
|
|
6543
|
+
if (method !== 'create-index' && method !== 'mkdir-index') {
|
|
6544
|
+
const { object } = await _readObject({
|
|
6545
|
+
fs,
|
|
6546
|
+
cache,
|
|
6547
|
+
gitdir,
|
|
6548
|
+
oid,
|
|
6549
|
+
});
|
|
6550
|
+
if (chmod) {
|
|
6551
|
+
// Note: the mode option of fs.write only works when creating files,
|
|
6552
|
+
// not updating them. Since the `fs` plugin doesn't expose `chmod` this
|
|
6553
|
+
// is our only option.
|
|
6554
|
+
await fs.rm(filepath);
|
|
6555
|
+
}
|
|
6556
|
+
if (mode === 0o100644) {
|
|
6557
|
+
// regular file
|
|
6558
|
+
await fs.write(filepath, object);
|
|
6559
|
+
} else if (mode === 0o100755) {
|
|
6560
|
+
// executable file
|
|
6561
|
+
await fs.write(filepath, object, { mode: 0o777 });
|
|
6562
|
+
} else if (mode === 0o120000) {
|
|
6563
|
+
// symlink
|
|
6564
|
+
await fs.writelink(filepath, object);
|
|
6565
|
+
} else {
|
|
6566
|
+
throw new InternalError(
|
|
6567
|
+
`Invalid mode 0o${mode.toString(
|
|
6568
|
+
8
|
|
6569
|
+
)} detected in blob ${oid}`
|
|
6570
|
+
)
|
|
6571
|
+
}
|
|
6572
|
+
}
|
|
6573
|
+
|
|
6574
|
+
const stats = await fs.lstat(filepath);
|
|
6575
|
+
// We can't trust the executable bit returned by lstat on Windows,
|
|
6576
|
+
// so we need to preserve this value from the TREE.
|
|
6577
|
+
// TODO: Figure out how git handles this internally.
|
|
6578
|
+
if (mode === 0o100755) {
|
|
6579
|
+
stats.mode = 0o755;
|
|
6580
|
+
}
|
|
6581
|
+
// Submodules are present in the git index but use a unique mode different from trees
|
|
6582
|
+
if (method === 'mkdir-index') {
|
|
6583
|
+
stats.mode = 0o160000;
|
|
6584
|
+
}
|
|
6585
|
+
index.insert({
|
|
6586
|
+
filepath: fullpath,
|
|
6587
|
+
stats,
|
|
6588
|
+
oid,
|
|
6589
|
+
});
|
|
6590
|
+
if (onProgress) {
|
|
6591
|
+
await onProgress({
|
|
6592
|
+
phase: 'Updating workdir',
|
|
6593
|
+
loaded: ++count,
|
|
6594
|
+
total,
|
|
6595
|
+
});
|
|
6596
|
+
}
|
|
6597
|
+
} catch (e) {
|
|
6598
|
+
console.log(e);
|
|
6599
|
+
}
|
|
6600
|
+
})
|
|
6601
|
+
);
|
|
6602
|
+
}
|
|
6603
|
+
);
|
|
6604
|
+
}
|
|
6551
6605
|
|
|
6552
6606
|
if (onPostCheckout) {
|
|
6553
6607
|
await onPostCheckout({
|
|
@@ -6865,6 +6919,78 @@ async function analyze({
|
|
|
6865
6919
|
})
|
|
6866
6920
|
}
|
|
6867
6921
|
|
|
6922
|
+
async function updateIndex({ index, fullpath, stats, oid }) {
|
|
6923
|
+
try {
|
|
6924
|
+
index.insert({
|
|
6925
|
+
filepath: fullpath,
|
|
6926
|
+
stats,
|
|
6927
|
+
oid,
|
|
6928
|
+
});
|
|
6929
|
+
} catch (e) {
|
|
6930
|
+
console.warn(`Error inserting ${fullpath} into index:`, e);
|
|
6931
|
+
}
|
|
6932
|
+
}
|
|
6933
|
+
async function updateWorkingDir(
|
|
6934
|
+
{ fs, cache, gitdir, dir },
|
|
6935
|
+
[method, fullpath, oid, mode, chmod]
|
|
6936
|
+
) {
|
|
6937
|
+
const filepath = `${dir}/${fullpath}`;
|
|
6938
|
+
if (method !== 'create-index' && method !== 'mkdir-index') {
|
|
6939
|
+
const { object } = await _readObject({ fs, cache, gitdir, oid });
|
|
6940
|
+
if (chmod) {
|
|
6941
|
+
await fs.rm(filepath);
|
|
6942
|
+
}
|
|
6943
|
+
if (mode === 0o100644) {
|
|
6944
|
+
// regular file
|
|
6945
|
+
await fs.write(filepath, object);
|
|
6946
|
+
} else if (mode === 0o100755) {
|
|
6947
|
+
// executable file
|
|
6948
|
+
await fs.write(filepath, object, { mode: 0o777 });
|
|
6949
|
+
} else if (mode === 0o120000) {
|
|
6950
|
+
// symlink
|
|
6951
|
+
await fs.writelink(filepath, object);
|
|
6952
|
+
} else {
|
|
6953
|
+
throw new InternalError(
|
|
6954
|
+
`Invalid mode 0o${mode.toString(8)} detected in blob ${oid}`
|
|
6955
|
+
)
|
|
6956
|
+
}
|
|
6957
|
+
}
|
|
6958
|
+
const stats = await fs.lstat(filepath);
|
|
6959
|
+
if (mode === 0o100755) {
|
|
6960
|
+
stats.mode = 0o755;
|
|
6961
|
+
}
|
|
6962
|
+
if (method === 'mkdir-index') {
|
|
6963
|
+
stats.mode = 0o160000;
|
|
6964
|
+
}
|
|
6965
|
+
return [fullpath, oid, stats]
|
|
6966
|
+
}
|
|
6967
|
+
|
|
6968
|
+
async function batchAllSettled(operationName, tasks, onProgress, batchSize) {
|
|
6969
|
+
const results = [];
|
|
6970
|
+
try {
|
|
6971
|
+
for (let i = 0; i < tasks.length; i += batchSize) {
|
|
6972
|
+
const batch = tasks.slice(i, i + batchSize).map(task => task());
|
|
6973
|
+
const batchResults = await Promise.allSettled(batch);
|
|
6974
|
+
batchResults.forEach(result => {
|
|
6975
|
+
if (result.status === 'fulfilled') results.push(result.value);
|
|
6976
|
+
});
|
|
6977
|
+
if (onProgress) {
|
|
6978
|
+
await onProgress({
|
|
6979
|
+
phase: 'Updating workdir',
|
|
6980
|
+
loaded: i + batch.length,
|
|
6981
|
+
total: tasks.length,
|
|
6982
|
+
});
|
|
6983
|
+
}
|
|
6984
|
+
}
|
|
6985
|
+
|
|
6986
|
+
return results
|
|
6987
|
+
} catch (error) {
|
|
6988
|
+
console.error(`Error during ${operationName}: ${error}`);
|
|
6989
|
+
}
|
|
6990
|
+
|
|
6991
|
+
return results
|
|
6992
|
+
}
|
|
6993
|
+
|
|
6868
6994
|
// @ts-check
|
|
6869
6995
|
|
|
6870
6996
|
/**
|
|
@@ -6887,6 +7013,8 @@ async function analyze({
|
|
|
6887
7013
|
* @param {boolean} [args.force = false] - If true, conflicts will be ignored and files will be overwritten regardless of local changes.
|
|
6888
7014
|
* @param {boolean} [args.track = true] - If false, will not set the remote branch tracking information. Defaults to true.
|
|
6889
7015
|
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
7016
|
+
* @param {boolean} [args.nonBlocking = false] - If true, will use non-blocking file system operations to allow for better performance in certain environments (For example, in Browsers)
|
|
7017
|
+
* @param {number} [args.batchSize = 100] - If args.nonBlocking is true, batchSize is the number of files to process at a time avoid blocking the executing thread. The default value of 100 is a good starting point.
|
|
6890
7018
|
*
|
|
6891
7019
|
* @returns {Promise<void>} Resolves successfully when filesystem operations are complete
|
|
6892
7020
|
*
|
|
@@ -6936,6 +7064,8 @@ async function checkout({
|
|
|
6936
7064
|
force = false,
|
|
6937
7065
|
track = true,
|
|
6938
7066
|
cache = {},
|
|
7067
|
+
nonBlocking = false,
|
|
7068
|
+
batchSize = 100,
|
|
6939
7069
|
}) {
|
|
6940
7070
|
try {
|
|
6941
7071
|
assertParameter('fs', fs);
|
|
@@ -6958,6 +7088,8 @@ async function checkout({
|
|
|
6958
7088
|
dryRun,
|
|
6959
7089
|
force,
|
|
6960
7090
|
track,
|
|
7091
|
+
nonBlocking,
|
|
7092
|
+
batchSize,
|
|
6961
7093
|
})
|
|
6962
7094
|
} catch (err) {
|
|
6963
7095
|
err.caller = 'git.checkout';
|
|
@@ -7644,8 +7776,8 @@ function filterCapabilities(server, client) {
|
|
|
7644
7776
|
|
|
7645
7777
|
const pkg = {
|
|
7646
7778
|
name: 'isomorphic-git',
|
|
7647
|
-
version: '1.
|
|
7648
|
-
agent: 'git/isomorphic-git@1.
|
|
7779
|
+
version: '1.31.0',
|
|
7780
|
+
agent: 'git/isomorphic-git@1.31.0',
|
|
7649
7781
|
};
|
|
7650
7782
|
|
|
7651
7783
|
class FIFO {
|
|
@@ -8400,6 +8532,8 @@ async function _init({
|
|
|
8400
8532
|
* @param {string[]} args.exclude
|
|
8401
8533
|
* @param {boolean} args.relative
|
|
8402
8534
|
* @param {Object<string, string>} args.headers
|
|
8535
|
+
* @param {boolean} [args.nonBlocking]
|
|
8536
|
+
* @param {number} [args.batchSize]
|
|
8403
8537
|
*
|
|
8404
8538
|
* @returns {Promise<void>} Resolves successfully when clone completes
|
|
8405
8539
|
*
|
|
@@ -8428,6 +8562,8 @@ async function _clone({
|
|
|
8428
8562
|
noCheckout,
|
|
8429
8563
|
noTags,
|
|
8430
8564
|
headers,
|
|
8565
|
+
nonBlocking,
|
|
8566
|
+
batchSize = 100,
|
|
8431
8567
|
}) {
|
|
8432
8568
|
try {
|
|
8433
8569
|
await _init({ fs, gitdir });
|
|
@@ -8472,6 +8608,8 @@ async function _clone({
|
|
|
8472
8608
|
ref,
|
|
8473
8609
|
remote,
|
|
8474
8610
|
noCheckout,
|
|
8611
|
+
nonBlocking,
|
|
8612
|
+
batchSize,
|
|
8475
8613
|
});
|
|
8476
8614
|
} catch (err) {
|
|
8477
8615
|
// Remove partial local repository, see #1283
|
|
@@ -8513,6 +8651,8 @@ async function _clone({
|
|
|
8513
8651
|
* @param {boolean} [args.relative = false] - Changes the meaning of `depth` to be measured from the current shallow depth rather than from the branch tip.
|
|
8514
8652
|
* @param {Object<string, string>} [args.headers = {}] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config
|
|
8515
8653
|
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
8654
|
+
* @param {boolean} [args.nonBlocking = false] - if true, checkout will happen non-blockingly (useful for long-running operations blocking the thread in browser environments)
|
|
8655
|
+
* @param {number} [args.batchSize = 100] - If args.nonBlocking is true, batchSize is the number of files to process at a time avoid blocking the executing thread. The default value of 100 is a good starting point.
|
|
8516
8656
|
*
|
|
8517
8657
|
* @returns {Promise<void>} Resolves successfully when clone completes
|
|
8518
8658
|
*
|
|
@@ -8553,6 +8693,8 @@ async function clone({
|
|
|
8553
8693
|
noTags = false,
|
|
8554
8694
|
headers = {},
|
|
8555
8695
|
cache = {},
|
|
8696
|
+
nonBlocking = false,
|
|
8697
|
+
batchSize = 100,
|
|
8556
8698
|
}) {
|
|
8557
8699
|
try {
|
|
8558
8700
|
assertParameter('fs', fs);
|
|
@@ -8587,6 +8729,8 @@ async function clone({
|
|
|
8587
8729
|
noCheckout,
|
|
8588
8730
|
noTags,
|
|
8589
8731
|
headers,
|
|
8732
|
+
nonBlocking,
|
|
8733
|
+
batchSize,
|
|
8590
8734
|
})
|
|
8591
8735
|
} catch (err) {
|
|
8592
8736
|
err.caller = 'git.clone';
|
|
@@ -9392,7 +9536,12 @@ async function mergeTree({
|
|
|
9392
9536
|
}
|
|
9393
9537
|
|
|
9394
9538
|
// deleted by both
|
|
9395
|
-
if (
|
|
9539
|
+
if (
|
|
9540
|
+
base &&
|
|
9541
|
+
!ours &&
|
|
9542
|
+
!theirs &&
|
|
9543
|
+
((await base.type()) === 'blob' || (await base.type()) === 'tree')
|
|
9544
|
+
) {
|
|
9396
9545
|
return undefined
|
|
9397
9546
|
}
|
|
9398
9547
|
|
|
@@ -9416,9 +9565,19 @@ async function mergeTree({
|
|
|
9416
9565
|
if (!parent) return
|
|
9417
9566
|
|
|
9418
9567
|
// automatically delete directories if they have been emptied
|
|
9419
|
-
|
|
9568
|
+
// except for the root directory
|
|
9569
|
+
if (
|
|
9570
|
+
parent &&
|
|
9571
|
+
parent.type === 'tree' &&
|
|
9572
|
+
entries.length === 0 &&
|
|
9573
|
+
parent.path !== '.'
|
|
9574
|
+
)
|
|
9575
|
+
return
|
|
9420
9576
|
|
|
9421
|
-
if (
|
|
9577
|
+
if (
|
|
9578
|
+
entries.length > 0 ||
|
|
9579
|
+
(parent.path === '.' && entries.length === 0)
|
|
9580
|
+
) {
|
|
9422
9581
|
const tree = new GitTree(entries);
|
|
9423
9582
|
const object = tree.toObject();
|
|
9424
9583
|
const oid = await _writeObject({
|
|
@@ -9682,7 +9841,7 @@ async function _merge({
|
|
|
9682
9841
|
);
|
|
9683
9842
|
|
|
9684
9843
|
// Defer throwing error until the index lock is relinquished and index is
|
|
9685
|
-
// written to
|
|
9844
|
+
// written to filesystem
|
|
9686
9845
|
if (tree instanceof MergeConflictError) throw tree
|
|
9687
9846
|
|
|
9688
9847
|
if (!message) {
|
|
@@ -15297,7 +15456,7 @@ async function tag({
|
|
|
15297
15456
|
* oid
|
|
15298
15457
|
* })
|
|
15299
15458
|
*/
|
|
15300
|
-
async function updateIndex({
|
|
15459
|
+
async function updateIndex$1({
|
|
15301
15460
|
fs: _fs,
|
|
15302
15461
|
dir,
|
|
15303
15462
|
gitdir = pathBrowserify.join(dir, '.git'),
|
|
@@ -16167,7 +16326,7 @@ var index = {
|
|
|
16167
16326
|
removeNote,
|
|
16168
16327
|
renameBranch,
|
|
16169
16328
|
resetIndex,
|
|
16170
|
-
updateIndex,
|
|
16329
|
+
updateIndex: updateIndex$1,
|
|
16171
16330
|
resolveRef,
|
|
16172
16331
|
status,
|
|
16173
16332
|
statusMatrix,
|
|
@@ -16245,7 +16404,7 @@ exports.stash = stash;
|
|
|
16245
16404
|
exports.status = status;
|
|
16246
16405
|
exports.statusMatrix = statusMatrix;
|
|
16247
16406
|
exports.tag = tag;
|
|
16248
|
-
exports.updateIndex = updateIndex;
|
|
16407
|
+
exports.updateIndex = updateIndex$1;
|
|
16249
16408
|
exports.version = version;
|
|
16250
16409
|
exports.walk = walk;
|
|
16251
16410
|
exports.writeBlob = writeBlob;
|
package/index.d.ts
CHANGED
|
@@ -681,7 +681,7 @@ declare namespace index {
|
|
|
681
681
|
export { removeNote };
|
|
682
682
|
export { renameBranch };
|
|
683
683
|
export { resetIndex };
|
|
684
|
-
export { updateIndex };
|
|
684
|
+
export { updateIndex$1 as updateIndex };
|
|
685
685
|
export { resolveRef };
|
|
686
686
|
export { status };
|
|
687
687
|
export { statusMatrix };
|
|
@@ -993,6 +993,8 @@ export function branch({ fs, dir, gitdir, ref, object, checkout, force, }: {
|
|
|
993
993
|
* @param {boolean} [args.force = false] - If true, conflicts will be ignored and files will be overwritten regardless of local changes.
|
|
994
994
|
* @param {boolean} [args.track = true] - If false, will not set the remote branch tracking information. Defaults to true.
|
|
995
995
|
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
996
|
+
* @param {boolean} [args.nonBlocking = false] - If true, will use non-blocking file system operations to allow for better performance in certain environments (For example, in Browsers)
|
|
997
|
+
* @param {number} [args.batchSize = 100] - If args.nonBlocking is true, batchSize is the number of files to process at a time avoid blocking the executing thread. The default value of 100 is a good starting point.
|
|
996
998
|
*
|
|
997
999
|
* @returns {Promise<void>} Resolves successfully when filesystem operations are complete
|
|
998
1000
|
*
|
|
@@ -1027,7 +1029,7 @@ export function branch({ fs, dir, gitdir, ref, object, checkout, force, }: {
|
|
|
1027
1029
|
* })
|
|
1028
1030
|
* console.log('done')
|
|
1029
1031
|
*/
|
|
1030
|
-
export function checkout({ fs, onProgress, onPostCheckout, dir, gitdir, remote, ref: _ref, filepaths, noCheckout, noUpdateHead, dryRun, force, track, cache, }: {
|
|
1032
|
+
export function checkout({ fs, onProgress, onPostCheckout, dir, gitdir, remote, ref: _ref, filepaths, noCheckout, noUpdateHead, dryRun, force, track, cache, nonBlocking, batchSize, }: {
|
|
1031
1033
|
fs: FsClient;
|
|
1032
1034
|
onProgress?: ProgressCallback | undefined;
|
|
1033
1035
|
onPostCheckout?: PostCheckoutCallback | undefined;
|
|
@@ -1042,6 +1044,8 @@ export function checkout({ fs, onProgress, onPostCheckout, dir, gitdir, remote,
|
|
|
1042
1044
|
force?: boolean | undefined;
|
|
1043
1045
|
track?: boolean | undefined;
|
|
1044
1046
|
cache?: object;
|
|
1047
|
+
nonBlocking?: boolean | undefined;
|
|
1048
|
+
batchSize?: number | undefined;
|
|
1045
1049
|
}): Promise<void>;
|
|
1046
1050
|
/**
|
|
1047
1051
|
* Clone a repository
|
|
@@ -1070,6 +1074,8 @@ export function checkout({ fs, onProgress, onPostCheckout, dir, gitdir, remote,
|
|
|
1070
1074
|
* @param {boolean} [args.relative = false] - Changes the meaning of `depth` to be measured from the current shallow depth rather than from the branch tip.
|
|
1071
1075
|
* @param {Object<string, string>} [args.headers = {}] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config
|
|
1072
1076
|
* @param {object} [args.cache] - a [cache](cache.md) object
|
|
1077
|
+
* @param {boolean} [args.nonBlocking = false] - if true, checkout will happen non-blockingly (useful for long-running operations blocking the thread in browser environments)
|
|
1078
|
+
* @param {number} [args.batchSize = 100] - If args.nonBlocking is true, batchSize is the number of files to process at a time avoid blocking the executing thread. The default value of 100 is a good starting point.
|
|
1073
1079
|
*
|
|
1074
1080
|
* @returns {Promise<void>} Resolves successfully when clone completes
|
|
1075
1081
|
*
|
|
@@ -1086,7 +1092,7 @@ export function checkout({ fs, onProgress, onPostCheckout, dir, gitdir, remote,
|
|
|
1086
1092
|
* console.log('done')
|
|
1087
1093
|
*
|
|
1088
1094
|
*/
|
|
1089
|
-
export function clone({ fs, http, onProgress, onMessage, onAuth, onAuthSuccess, onAuthFailure, onPostCheckout, dir, gitdir, url, corsProxy, ref, remote, depth, since, exclude, relative, singleBranch, noCheckout, noTags, headers, cache, }: {
|
|
1095
|
+
export function clone({ fs, http, onProgress, onMessage, onAuth, onAuthSuccess, onAuthFailure, onPostCheckout, dir, gitdir, url, corsProxy, ref, remote, depth, since, exclude, relative, singleBranch, noCheckout, noTags, headers, cache, nonBlocking, batchSize, }: {
|
|
1090
1096
|
fs: FsClient;
|
|
1091
1097
|
http: HttpClient;
|
|
1092
1098
|
onProgress?: ProgressCallback | undefined;
|
|
@@ -1112,6 +1118,8 @@ export function clone({ fs, http, onProgress, onMessage, onAuth, onAuthSuccess,
|
|
|
1112
1118
|
[x: string]: string;
|
|
1113
1119
|
} | undefined;
|
|
1114
1120
|
cache?: object;
|
|
1121
|
+
nonBlocking?: boolean | undefined;
|
|
1122
|
+
batchSize?: number | undefined;
|
|
1115
1123
|
}): Promise<void>;
|
|
1116
1124
|
/**
|
|
1117
1125
|
* Create a new commit
|
|
@@ -3342,7 +3350,7 @@ export function tag({ fs: _fs, dir, gitdir, ref, object, force, }: {
|
|
|
3342
3350
|
* oid
|
|
3343
3351
|
* })
|
|
3344
3352
|
*/
|
|
3345
|
-
|
|
3353
|
+
declare function updateIndex$1({ fs: _fs, dir, gitdir, cache, filepath, oid, mode, add, remove, force, }: {
|
|
3346
3354
|
fs: FsClient;
|
|
3347
3355
|
dir: string;
|
|
3348
3356
|
gitdir?: string | undefined;
|
|
@@ -4650,3 +4658,4 @@ declare class BaseError extends Error {
|
|
|
4650
4658
|
fromJSON(json: any): BaseError;
|
|
4651
4659
|
get isIsomorphicGitError(): boolean;
|
|
4652
4660
|
}
|
|
4661
|
+
export { updateIndex$1 as updateIndex };
|