isomorphic-git 1.41.2 → 1.41.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/index.cjs +23 -6
- package/index.d.cts +2 -2
- package/index.d.ts +2 -2
- package/index.js +23 -6
- package/index.umd.min.d.ts +2 -2
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -7093,6 +7093,7 @@ const worthWalking = (filepath, root) => {
|
|
|
7093
7093
|
* @param {boolean} [args.dryRun]
|
|
7094
7094
|
* @param {boolean} [args.force]
|
|
7095
7095
|
* @param {boolean} [args.track]
|
|
7096
|
+
* @param {boolean} [args.restoreFromIndex]
|
|
7096
7097
|
* @param {boolean} [args.nonBlocking]
|
|
7097
7098
|
* @param {number} [args.batchSize]
|
|
7098
7099
|
*
|
|
@@ -7114,6 +7115,7 @@ async function _checkout({
|
|
|
7114
7115
|
dryRun,
|
|
7115
7116
|
force,
|
|
7116
7117
|
track = true,
|
|
7118
|
+
restoreFromIndex = false,
|
|
7117
7119
|
nonBlocking = false,
|
|
7118
7120
|
batchSize = 100,
|
|
7119
7121
|
}) {
|
|
@@ -7173,6 +7175,7 @@ async function _checkout({
|
|
|
7173
7175
|
ref,
|
|
7174
7176
|
force,
|
|
7175
7177
|
filepaths,
|
|
7178
|
+
restoreFromIndex,
|
|
7176
7179
|
});
|
|
7177
7180
|
} catch (err) {
|
|
7178
7181
|
// Throw a more helpful error message for this common mistake.
|
|
@@ -7465,6 +7468,7 @@ async function analyze({
|
|
|
7465
7468
|
ref,
|
|
7466
7469
|
force,
|
|
7467
7470
|
filepaths,
|
|
7471
|
+
restoreFromIndex,
|
|
7468
7472
|
}) {
|
|
7469
7473
|
let count = 0;
|
|
7470
7474
|
return _walk({
|
|
@@ -7472,7 +7476,7 @@ async function analyze({
|
|
|
7472
7476
|
cache,
|
|
7473
7477
|
dir,
|
|
7474
7478
|
gitdir,
|
|
7475
|
-
trees: [TREE({ ref }), WORKDIR(), STAGE()],
|
|
7479
|
+
trees: [restoreFromIndex ? STAGE() : TREE({ ref }), WORKDIR(), STAGE()],
|
|
7476
7480
|
map: async function (fullpath, [commit, workdir, stage]) {
|
|
7477
7481
|
if (fullpath === '.') return
|
|
7478
7482
|
// match against base paths
|
|
@@ -7497,7 +7501,12 @@ async function analyze({
|
|
|
7497
7501
|
// Ignore workdir files that are not tracked and not part of the new commit.
|
|
7498
7502
|
case '001':
|
|
7499
7503
|
// OK, make an exception for explicitly named files.
|
|
7500
|
-
if (
|
|
7504
|
+
if (
|
|
7505
|
+
!restoreFromIndex &&
|
|
7506
|
+
force &&
|
|
7507
|
+
filepaths &&
|
|
7508
|
+
filepaths.includes(fullpath)
|
|
7509
|
+
) {
|
|
7501
7510
|
return ['delete', fullpath]
|
|
7502
7511
|
}
|
|
7503
7512
|
return
|
|
@@ -7840,7 +7849,7 @@ async function batchAllSettled(operationName, tasks, onProgress, batchSize) {
|
|
|
7840
7849
|
* @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path
|
|
7841
7850
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
7842
7851
|
* @param {string} [args.ref = 'HEAD'] - Source to checkout files from
|
|
7843
|
-
* @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories
|
|
7852
|
+
* @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories. If `ref` is not provided, restore them from the index.
|
|
7844
7853
|
* @param {string} [args.remote = 'origin'] - Which remote repository to use
|
|
7845
7854
|
* @param {boolean} [args.noCheckout = false] - If true, will update HEAD but won't update the working directory
|
|
7846
7855
|
* @param {boolean} [args.noUpdateHead] - If true, will update the working directory but won't update HEAD. Defaults to `false` when `ref` is provided, and `true` if `ref` is not provided.
|
|
@@ -7863,7 +7872,7 @@ async function batchAllSettled(operationName, tasks, onProgress, batchSize) {
|
|
|
7863
7872
|
* console.log('done')
|
|
7864
7873
|
*
|
|
7865
7874
|
* @example
|
|
7866
|
-
* // restore the 'docs' and 'src/docs' folders
|
|
7875
|
+
* // restore the 'docs' and 'src/docs' folders from the index, overwriting any unstaged changes
|
|
7867
7876
|
* await git.checkout({
|
|
7868
7877
|
* fs,
|
|
7869
7878
|
* dir: '/tutorial',
|
|
@@ -7908,6 +7917,8 @@ async function checkout({
|
|
|
7908
7917
|
assertParameter('gitdir', gitdir);
|
|
7909
7918
|
|
|
7910
7919
|
const ref = _ref || 'HEAD';
|
|
7920
|
+
const restoreFromIndex =
|
|
7921
|
+
_ref === undefined && filepaths != null && filepaths.length > 0;
|
|
7911
7922
|
const fsp = new FileSystem(fs);
|
|
7912
7923
|
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
7913
7924
|
return await _checkout({
|
|
@@ -7925,6 +7936,7 @@ async function checkout({
|
|
|
7925
7936
|
dryRun,
|
|
7926
7937
|
force,
|
|
7927
7938
|
track,
|
|
7939
|
+
restoreFromIndex,
|
|
7928
7940
|
nonBlocking,
|
|
7929
7941
|
batchSize,
|
|
7930
7942
|
})
|
|
@@ -9700,8 +9712,8 @@ function filterCapabilities(server, client) {
|
|
|
9700
9712
|
|
|
9701
9713
|
const pkg = {
|
|
9702
9714
|
name: 'isomorphic-git',
|
|
9703
|
-
version: '1.41.
|
|
9704
|
-
agent: 'git/isomorphic-git@1.41.
|
|
9715
|
+
version: '1.41.4',
|
|
9716
|
+
agent: 'git/isomorphic-git@1.41.4',
|
|
9705
9717
|
};
|
|
9706
9718
|
|
|
9707
9719
|
class FIFO {
|
|
@@ -9778,6 +9790,11 @@ function splitLines(input) {
|
|
|
9778
9790
|
while (true) {
|
|
9779
9791
|
const i = findSplit(tmp);
|
|
9780
9792
|
if (i === -1) break
|
|
9793
|
+
// A '\r' at the very end may be the first half of a '\r\n' whose '\n'
|
|
9794
|
+
// arrives in the next chunk. Hold it back until there is a character
|
|
9795
|
+
// after it to look at, otherwise the same bytes split into two lines
|
|
9796
|
+
// or one depending only on where the socket boundary fell.
|
|
9797
|
+
if (i === tmp.length && tmp[i - 1] === '\r') break
|
|
9781
9798
|
output.write(tmp.slice(0, i));
|
|
9782
9799
|
tmp = tmp.slice(i);
|
|
9783
9800
|
}
|
package/index.d.cts
CHANGED
|
@@ -931,7 +931,7 @@ export function branch({ fs, dir, gitdir, ref, object, checkout, force, }: {
|
|
|
931
931
|
* @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path
|
|
932
932
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
933
933
|
* @param {string} [args.ref = 'HEAD'] - Source to checkout files from
|
|
934
|
-
* @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories
|
|
934
|
+
* @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories. If `ref` is not provided, restore them from the index.
|
|
935
935
|
* @param {string} [args.remote = 'origin'] - Which remote repository to use
|
|
936
936
|
* @param {boolean} [args.noCheckout = false] - If true, will update HEAD but won't update the working directory
|
|
937
937
|
* @param {boolean} [args.noUpdateHead] - If true, will update the working directory but won't update HEAD. Defaults to `false` when `ref` is provided, and `true` if `ref` is not provided.
|
|
@@ -954,7 +954,7 @@ export function branch({ fs, dir, gitdir, ref, object, checkout, force, }: {
|
|
|
954
954
|
* console.log('done')
|
|
955
955
|
*
|
|
956
956
|
* @example
|
|
957
|
-
* // restore the 'docs' and 'src/docs' folders
|
|
957
|
+
* // restore the 'docs' and 'src/docs' folders from the index, overwriting any unstaged changes
|
|
958
958
|
* await git.checkout({
|
|
959
959
|
* fs,
|
|
960
960
|
* dir: '/tutorial',
|
package/index.d.ts
CHANGED
|
@@ -1003,7 +1003,7 @@ export function branch({ fs, dir, gitdir, ref, object, checkout, force, }: {
|
|
|
1003
1003
|
* @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path
|
|
1004
1004
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
1005
1005
|
* @param {string} [args.ref = 'HEAD'] - Source to checkout files from
|
|
1006
|
-
* @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories
|
|
1006
|
+
* @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories. If `ref` is not provided, restore them from the index.
|
|
1007
1007
|
* @param {string} [args.remote = 'origin'] - Which remote repository to use
|
|
1008
1008
|
* @param {boolean} [args.noCheckout = false] - If true, will update HEAD but won't update the working directory
|
|
1009
1009
|
* @param {boolean} [args.noUpdateHead] - If true, will update the working directory but won't update HEAD. Defaults to `false` when `ref` is provided, and `true` if `ref` is not provided.
|
|
@@ -1026,7 +1026,7 @@ export function branch({ fs, dir, gitdir, ref, object, checkout, force, }: {
|
|
|
1026
1026
|
* console.log('done')
|
|
1027
1027
|
*
|
|
1028
1028
|
* @example
|
|
1029
|
-
* // restore the 'docs' and 'src/docs' folders
|
|
1029
|
+
* // restore the 'docs' and 'src/docs' folders from the index, overwriting any unstaged changes
|
|
1030
1030
|
* await git.checkout({
|
|
1031
1031
|
* fs,
|
|
1032
1032
|
* dir: '/tutorial',
|
package/index.js
CHANGED
|
@@ -7080,6 +7080,7 @@ const worthWalking = (filepath, root) => {
|
|
|
7080
7080
|
* @param {boolean} [args.dryRun]
|
|
7081
7081
|
* @param {boolean} [args.force]
|
|
7082
7082
|
* @param {boolean} [args.track]
|
|
7083
|
+
* @param {boolean} [args.restoreFromIndex]
|
|
7083
7084
|
* @param {boolean} [args.nonBlocking]
|
|
7084
7085
|
* @param {number} [args.batchSize]
|
|
7085
7086
|
*
|
|
@@ -7101,6 +7102,7 @@ async function _checkout({
|
|
|
7101
7102
|
dryRun,
|
|
7102
7103
|
force,
|
|
7103
7104
|
track = true,
|
|
7105
|
+
restoreFromIndex = false,
|
|
7104
7106
|
nonBlocking = false,
|
|
7105
7107
|
batchSize = 100,
|
|
7106
7108
|
}) {
|
|
@@ -7160,6 +7162,7 @@ async function _checkout({
|
|
|
7160
7162
|
ref,
|
|
7161
7163
|
force,
|
|
7162
7164
|
filepaths,
|
|
7165
|
+
restoreFromIndex,
|
|
7163
7166
|
});
|
|
7164
7167
|
} catch (err) {
|
|
7165
7168
|
// Throw a more helpful error message for this common mistake.
|
|
@@ -7452,6 +7455,7 @@ async function analyze({
|
|
|
7452
7455
|
ref,
|
|
7453
7456
|
force,
|
|
7454
7457
|
filepaths,
|
|
7458
|
+
restoreFromIndex,
|
|
7455
7459
|
}) {
|
|
7456
7460
|
let count = 0;
|
|
7457
7461
|
return _walk({
|
|
@@ -7459,7 +7463,7 @@ async function analyze({
|
|
|
7459
7463
|
cache,
|
|
7460
7464
|
dir,
|
|
7461
7465
|
gitdir,
|
|
7462
|
-
trees: [TREE({ ref }), WORKDIR(), STAGE()],
|
|
7466
|
+
trees: [restoreFromIndex ? STAGE() : TREE({ ref }), WORKDIR(), STAGE()],
|
|
7463
7467
|
map: async function (fullpath, [commit, workdir, stage]) {
|
|
7464
7468
|
if (fullpath === '.') return
|
|
7465
7469
|
// match against base paths
|
|
@@ -7484,7 +7488,12 @@ async function analyze({
|
|
|
7484
7488
|
// Ignore workdir files that are not tracked and not part of the new commit.
|
|
7485
7489
|
case '001':
|
|
7486
7490
|
// OK, make an exception for explicitly named files.
|
|
7487
|
-
if (
|
|
7491
|
+
if (
|
|
7492
|
+
!restoreFromIndex &&
|
|
7493
|
+
force &&
|
|
7494
|
+
filepaths &&
|
|
7495
|
+
filepaths.includes(fullpath)
|
|
7496
|
+
) {
|
|
7488
7497
|
return ['delete', fullpath]
|
|
7489
7498
|
}
|
|
7490
7499
|
return
|
|
@@ -7827,7 +7836,7 @@ async function batchAllSettled(operationName, tasks, onProgress, batchSize) {
|
|
|
7827
7836
|
* @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path
|
|
7828
7837
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
7829
7838
|
* @param {string} [args.ref = 'HEAD'] - Source to checkout files from
|
|
7830
|
-
* @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories
|
|
7839
|
+
* @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories. If `ref` is not provided, restore them from the index.
|
|
7831
7840
|
* @param {string} [args.remote = 'origin'] - Which remote repository to use
|
|
7832
7841
|
* @param {boolean} [args.noCheckout = false] - If true, will update HEAD but won't update the working directory
|
|
7833
7842
|
* @param {boolean} [args.noUpdateHead] - If true, will update the working directory but won't update HEAD. Defaults to `false` when `ref` is provided, and `true` if `ref` is not provided.
|
|
@@ -7850,7 +7859,7 @@ async function batchAllSettled(operationName, tasks, onProgress, batchSize) {
|
|
|
7850
7859
|
* console.log('done')
|
|
7851
7860
|
*
|
|
7852
7861
|
* @example
|
|
7853
|
-
* // restore the 'docs' and 'src/docs' folders
|
|
7862
|
+
* // restore the 'docs' and 'src/docs' folders from the index, overwriting any unstaged changes
|
|
7854
7863
|
* await git.checkout({
|
|
7855
7864
|
* fs,
|
|
7856
7865
|
* dir: '/tutorial',
|
|
@@ -7895,6 +7904,8 @@ async function checkout({
|
|
|
7895
7904
|
assertParameter('gitdir', gitdir);
|
|
7896
7905
|
|
|
7897
7906
|
const ref = _ref || 'HEAD';
|
|
7907
|
+
const restoreFromIndex =
|
|
7908
|
+
_ref === undefined && filepaths != null && filepaths.length > 0;
|
|
7898
7909
|
const fsp = new FileSystem(fs);
|
|
7899
7910
|
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
7900
7911
|
return await _checkout({
|
|
@@ -7912,6 +7923,7 @@ async function checkout({
|
|
|
7912
7923
|
dryRun,
|
|
7913
7924
|
force,
|
|
7914
7925
|
track,
|
|
7926
|
+
restoreFromIndex,
|
|
7915
7927
|
nonBlocking,
|
|
7916
7928
|
batchSize,
|
|
7917
7929
|
})
|
|
@@ -9687,8 +9699,8 @@ function filterCapabilities(server, client) {
|
|
|
9687
9699
|
|
|
9688
9700
|
const pkg = {
|
|
9689
9701
|
name: 'isomorphic-git',
|
|
9690
|
-
version: '1.41.
|
|
9691
|
-
agent: 'git/isomorphic-git@1.41.
|
|
9702
|
+
version: '1.41.4',
|
|
9703
|
+
agent: 'git/isomorphic-git@1.41.4',
|
|
9692
9704
|
};
|
|
9693
9705
|
|
|
9694
9706
|
class FIFO {
|
|
@@ -9765,6 +9777,11 @@ function splitLines(input) {
|
|
|
9765
9777
|
while (true) {
|
|
9766
9778
|
const i = findSplit(tmp);
|
|
9767
9779
|
if (i === -1) break
|
|
9780
|
+
// A '\r' at the very end may be the first half of a '\r\n' whose '\n'
|
|
9781
|
+
// arrives in the next chunk. Hold it back until there is a character
|
|
9782
|
+
// after it to look at, otherwise the same bytes split into two lines
|
|
9783
|
+
// or one depending only on where the socket boundary fell.
|
|
9784
|
+
if (i === tmp.length && tmp[i - 1] === '\r') break
|
|
9768
9785
|
output.write(tmp.slice(0, i));
|
|
9769
9786
|
tmp = tmp.slice(i);
|
|
9770
9787
|
}
|
package/index.umd.min.d.ts
CHANGED
|
@@ -1003,7 +1003,7 @@ export function branch({ fs, dir, gitdir, ref, object, checkout, force, }: {
|
|
|
1003
1003
|
* @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path
|
|
1004
1004
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
1005
1005
|
* @param {string} [args.ref = 'HEAD'] - Source to checkout files from
|
|
1006
|
-
* @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories
|
|
1006
|
+
* @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories. If `ref` is not provided, restore them from the index.
|
|
1007
1007
|
* @param {string} [args.remote = 'origin'] - Which remote repository to use
|
|
1008
1008
|
* @param {boolean} [args.noCheckout = false] - If true, will update HEAD but won't update the working directory
|
|
1009
1009
|
* @param {boolean} [args.noUpdateHead] - If true, will update the working directory but won't update HEAD. Defaults to `false` when `ref` is provided, and `true` if `ref` is not provided.
|
|
@@ -1026,7 +1026,7 @@ export function branch({ fs, dir, gitdir, ref, object, checkout, force, }: {
|
|
|
1026
1026
|
* console.log('done')
|
|
1027
1027
|
*
|
|
1028
1028
|
* @example
|
|
1029
|
-
* // restore the 'docs' and 'src/docs' folders
|
|
1029
|
+
* // restore the 'docs' and 'src/docs' folders from the index, overwriting any unstaged changes
|
|
1030
1030
|
* await git.checkout({
|
|
1031
1031
|
* fs,
|
|
1032
1032
|
* dir: '/tutorial',
|