isomorphic-git 1.41.3 → 1.41.5
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 +48 -15
- package/index.d.cts +2 -2
- package/index.d.ts +2 -2
- package/index.js +48 -15
- 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
|
@@ -6321,6 +6321,23 @@ async function constructTree({ fs, gitdir, inode, dryRun }) {
|
|
|
6321
6321
|
// @ts-check
|
|
6322
6322
|
|
|
6323
6323
|
async function resolveFilepath({ fs, cache, gitdir, oid, filepath }) {
|
|
6324
|
+
const entry = await resolveFilepathEntry({
|
|
6325
|
+
fs,
|
|
6326
|
+
cache,
|
|
6327
|
+
gitdir,
|
|
6328
|
+
oid,
|
|
6329
|
+
filepath,
|
|
6330
|
+
});
|
|
6331
|
+
return entry.oid
|
|
6332
|
+
}
|
|
6333
|
+
|
|
6334
|
+
async function resolveFilepathEntry({
|
|
6335
|
+
fs,
|
|
6336
|
+
cache,
|
|
6337
|
+
gitdir,
|
|
6338
|
+
oid,
|
|
6339
|
+
filepath,
|
|
6340
|
+
}) {
|
|
6324
6341
|
// Ensure there are no leading or trailing directory separators.
|
|
6325
6342
|
// I was going to do this automatically, but then found that the Git Terminal for Windows
|
|
6326
6343
|
// auto-expands --filepath=/src/utils to --filepath=C:/Users/Will/AppData/Local/Programs/Git/src/utils
|
|
@@ -6334,10 +6351,10 @@ async function resolveFilepath({ fs, cache, gitdir, oid, filepath }) {
|
|
|
6334
6351
|
const result = await resolveTree({ fs, cache, gitdir, oid });
|
|
6335
6352
|
const tree = result.tree;
|
|
6336
6353
|
if (filepath === '') {
|
|
6337
|
-
oid
|
|
6354
|
+
return { mode: '040000', oid: result.oid, path: '', type: 'tree' }
|
|
6338
6355
|
} else {
|
|
6339
6356
|
const pathArray = filepath.split('/');
|
|
6340
|
-
|
|
6357
|
+
return _resolveFilepath({
|
|
6341
6358
|
fs,
|
|
6342
6359
|
cache,
|
|
6343
6360
|
gitdir,
|
|
@@ -6345,9 +6362,8 @@ async function resolveFilepath({ fs, cache, gitdir, oid, filepath }) {
|
|
|
6345
6362
|
pathArray,
|
|
6346
6363
|
oid: _oid,
|
|
6347
6364
|
filepath,
|
|
6348
|
-
})
|
|
6365
|
+
})
|
|
6349
6366
|
}
|
|
6350
|
-
return oid
|
|
6351
6367
|
}
|
|
6352
6368
|
|
|
6353
6369
|
async function _resolveFilepath({
|
|
@@ -6363,7 +6379,7 @@ async function _resolveFilepath({
|
|
|
6363
6379
|
for (const entry of tree) {
|
|
6364
6380
|
if (entry.path === name) {
|
|
6365
6381
|
if (pathArray.length === 0) {
|
|
6366
|
-
return entry
|
|
6382
|
+
return entry
|
|
6367
6383
|
} else {
|
|
6368
6384
|
const { type, object } = await _readObject({
|
|
6369
6385
|
fs,
|
|
@@ -7093,6 +7109,7 @@ const worthWalking = (filepath, root) => {
|
|
|
7093
7109
|
* @param {boolean} [args.dryRun]
|
|
7094
7110
|
* @param {boolean} [args.force]
|
|
7095
7111
|
* @param {boolean} [args.track]
|
|
7112
|
+
* @param {boolean} [args.restoreFromIndex]
|
|
7096
7113
|
* @param {boolean} [args.nonBlocking]
|
|
7097
7114
|
* @param {number} [args.batchSize]
|
|
7098
7115
|
*
|
|
@@ -7114,6 +7131,7 @@ async function _checkout({
|
|
|
7114
7131
|
dryRun,
|
|
7115
7132
|
force,
|
|
7116
7133
|
track = true,
|
|
7134
|
+
restoreFromIndex = false,
|
|
7117
7135
|
nonBlocking = false,
|
|
7118
7136
|
batchSize = 100,
|
|
7119
7137
|
}) {
|
|
@@ -7173,6 +7191,7 @@ async function _checkout({
|
|
|
7173
7191
|
ref,
|
|
7174
7192
|
force,
|
|
7175
7193
|
filepaths,
|
|
7194
|
+
restoreFromIndex,
|
|
7176
7195
|
});
|
|
7177
7196
|
} catch (err) {
|
|
7178
7197
|
// Throw a more helpful error message for this common mistake.
|
|
@@ -7465,6 +7484,7 @@ async function analyze({
|
|
|
7465
7484
|
ref,
|
|
7466
7485
|
force,
|
|
7467
7486
|
filepaths,
|
|
7487
|
+
restoreFromIndex,
|
|
7468
7488
|
}) {
|
|
7469
7489
|
let count = 0;
|
|
7470
7490
|
return _walk({
|
|
@@ -7472,7 +7492,7 @@ async function analyze({
|
|
|
7472
7492
|
cache,
|
|
7473
7493
|
dir,
|
|
7474
7494
|
gitdir,
|
|
7475
|
-
trees: [TREE({ ref }), WORKDIR(), STAGE()],
|
|
7495
|
+
trees: [restoreFromIndex ? STAGE() : TREE({ ref }), WORKDIR(), STAGE()],
|
|
7476
7496
|
map: async function (fullpath, [commit, workdir, stage]) {
|
|
7477
7497
|
if (fullpath === '.') return
|
|
7478
7498
|
// match against base paths
|
|
@@ -7497,7 +7517,12 @@ async function analyze({
|
|
|
7497
7517
|
// Ignore workdir files that are not tracked and not part of the new commit.
|
|
7498
7518
|
case '001':
|
|
7499
7519
|
// OK, make an exception for explicitly named files.
|
|
7500
|
-
if (
|
|
7520
|
+
if (
|
|
7521
|
+
!restoreFromIndex &&
|
|
7522
|
+
force &&
|
|
7523
|
+
filepaths &&
|
|
7524
|
+
filepaths.includes(fullpath)
|
|
7525
|
+
) {
|
|
7501
7526
|
return ['delete', fullpath]
|
|
7502
7527
|
}
|
|
7503
7528
|
return
|
|
@@ -7840,7 +7865,7 @@ async function batchAllSettled(operationName, tasks, onProgress, batchSize) {
|
|
|
7840
7865
|
* @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path
|
|
7841
7866
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
7842
7867
|
* @param {string} [args.ref = 'HEAD'] - Source to checkout files from
|
|
7843
|
-
* @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories
|
|
7868
|
+
* @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories. If `ref` is not provided, restore them from the index.
|
|
7844
7869
|
* @param {string} [args.remote = 'origin'] - Which remote repository to use
|
|
7845
7870
|
* @param {boolean} [args.noCheckout = false] - If true, will update HEAD but won't update the working directory
|
|
7846
7871
|
* @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 +7888,7 @@ async function batchAllSettled(operationName, tasks, onProgress, batchSize) {
|
|
|
7863
7888
|
* console.log('done')
|
|
7864
7889
|
*
|
|
7865
7890
|
* @example
|
|
7866
|
-
* // restore the 'docs' and 'src/docs' folders
|
|
7891
|
+
* // restore the 'docs' and 'src/docs' folders from the index, overwriting any unstaged changes
|
|
7867
7892
|
* await git.checkout({
|
|
7868
7893
|
* fs,
|
|
7869
7894
|
* dir: '/tutorial',
|
|
@@ -7908,6 +7933,8 @@ async function checkout({
|
|
|
7908
7933
|
assertParameter('gitdir', gitdir);
|
|
7909
7934
|
|
|
7910
7935
|
const ref = _ref || 'HEAD';
|
|
7936
|
+
const restoreFromIndex =
|
|
7937
|
+
_ref === undefined && filepaths != null && filepaths.length > 0;
|
|
7911
7938
|
const fsp = new FileSystem(fs);
|
|
7912
7939
|
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
7913
7940
|
return await _checkout({
|
|
@@ -7925,6 +7952,7 @@ async function checkout({
|
|
|
7925
7952
|
dryRun,
|
|
7926
7953
|
force,
|
|
7927
7954
|
track,
|
|
7955
|
+
restoreFromIndex,
|
|
7928
7956
|
nonBlocking,
|
|
7929
7957
|
batchSize,
|
|
7930
7958
|
})
|
|
@@ -9700,8 +9728,8 @@ function filterCapabilities(server, client) {
|
|
|
9700
9728
|
|
|
9701
9729
|
const pkg = {
|
|
9702
9730
|
name: 'isomorphic-git',
|
|
9703
|
-
version: '1.41.
|
|
9704
|
-
agent: 'git/isomorphic-git@1.41.
|
|
9731
|
+
version: '1.41.5',
|
|
9732
|
+
agent: 'git/isomorphic-git@1.41.5',
|
|
9705
9733
|
};
|
|
9706
9734
|
|
|
9707
9735
|
class FIFO {
|
|
@@ -13315,6 +13343,7 @@ async function _log({
|
|
|
13315
13343
|
const oid = await GitRefManager.resolve({ fs, gitdir, ref });
|
|
13316
13344
|
const tips = [await _readCommit({ fs, cache, gitdir, oid })];
|
|
13317
13345
|
let lastFileOid;
|
|
13346
|
+
let lastFileMode;
|
|
13318
13347
|
let lastCommit;
|
|
13319
13348
|
let isOk;
|
|
13320
13349
|
|
|
@@ -13334,19 +13363,23 @@ async function _log({
|
|
|
13334
13363
|
}
|
|
13335
13364
|
|
|
13336
13365
|
if (filepath) {
|
|
13337
|
-
let
|
|
13366
|
+
let vFileEntry;
|
|
13338
13367
|
try {
|
|
13339
|
-
|
|
13368
|
+
vFileEntry = await resolveFilepathEntry({
|
|
13340
13369
|
fs,
|
|
13341
13370
|
cache,
|
|
13342
13371
|
gitdir,
|
|
13343
13372
|
oid: commit.commit.tree,
|
|
13344
13373
|
filepath,
|
|
13345
13374
|
});
|
|
13346
|
-
if (
|
|
13375
|
+
if (
|
|
13376
|
+
lastCommit &&
|
|
13377
|
+
(lastFileOid !== vFileEntry.oid || lastFileMode !== vFileEntry.mode)
|
|
13378
|
+
) {
|
|
13347
13379
|
commits.push(lastCommit);
|
|
13348
13380
|
}
|
|
13349
|
-
lastFileOid =
|
|
13381
|
+
lastFileOid = vFileEntry.oid;
|
|
13382
|
+
lastFileMode = vFileEntry.mode;
|
|
13350
13383
|
lastCommit = commit;
|
|
13351
13384
|
isOk = true;
|
|
13352
13385
|
} catch (e) {
|
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
|
@@ -6308,6 +6308,23 @@ async function constructTree({ fs, gitdir, inode, dryRun }) {
|
|
|
6308
6308
|
// @ts-check
|
|
6309
6309
|
|
|
6310
6310
|
async function resolveFilepath({ fs, cache, gitdir, oid, filepath }) {
|
|
6311
|
+
const entry = await resolveFilepathEntry({
|
|
6312
|
+
fs,
|
|
6313
|
+
cache,
|
|
6314
|
+
gitdir,
|
|
6315
|
+
oid,
|
|
6316
|
+
filepath,
|
|
6317
|
+
});
|
|
6318
|
+
return entry.oid
|
|
6319
|
+
}
|
|
6320
|
+
|
|
6321
|
+
async function resolveFilepathEntry({
|
|
6322
|
+
fs,
|
|
6323
|
+
cache,
|
|
6324
|
+
gitdir,
|
|
6325
|
+
oid,
|
|
6326
|
+
filepath,
|
|
6327
|
+
}) {
|
|
6311
6328
|
// Ensure there are no leading or trailing directory separators.
|
|
6312
6329
|
// I was going to do this automatically, but then found that the Git Terminal for Windows
|
|
6313
6330
|
// auto-expands --filepath=/src/utils to --filepath=C:/Users/Will/AppData/Local/Programs/Git/src/utils
|
|
@@ -6321,10 +6338,10 @@ async function resolveFilepath({ fs, cache, gitdir, oid, filepath }) {
|
|
|
6321
6338
|
const result = await resolveTree({ fs, cache, gitdir, oid });
|
|
6322
6339
|
const tree = result.tree;
|
|
6323
6340
|
if (filepath === '') {
|
|
6324
|
-
oid
|
|
6341
|
+
return { mode: '040000', oid: result.oid, path: '', type: 'tree' }
|
|
6325
6342
|
} else {
|
|
6326
6343
|
const pathArray = filepath.split('/');
|
|
6327
|
-
|
|
6344
|
+
return _resolveFilepath({
|
|
6328
6345
|
fs,
|
|
6329
6346
|
cache,
|
|
6330
6347
|
gitdir,
|
|
@@ -6332,9 +6349,8 @@ async function resolveFilepath({ fs, cache, gitdir, oid, filepath }) {
|
|
|
6332
6349
|
pathArray,
|
|
6333
6350
|
oid: _oid,
|
|
6334
6351
|
filepath,
|
|
6335
|
-
})
|
|
6352
|
+
})
|
|
6336
6353
|
}
|
|
6337
|
-
return oid
|
|
6338
6354
|
}
|
|
6339
6355
|
|
|
6340
6356
|
async function _resolveFilepath({
|
|
@@ -6350,7 +6366,7 @@ async function _resolveFilepath({
|
|
|
6350
6366
|
for (const entry of tree) {
|
|
6351
6367
|
if (entry.path === name) {
|
|
6352
6368
|
if (pathArray.length === 0) {
|
|
6353
|
-
return entry
|
|
6369
|
+
return entry
|
|
6354
6370
|
} else {
|
|
6355
6371
|
const { type, object } = await _readObject({
|
|
6356
6372
|
fs,
|
|
@@ -7080,6 +7096,7 @@ const worthWalking = (filepath, root) => {
|
|
|
7080
7096
|
* @param {boolean} [args.dryRun]
|
|
7081
7097
|
* @param {boolean} [args.force]
|
|
7082
7098
|
* @param {boolean} [args.track]
|
|
7099
|
+
* @param {boolean} [args.restoreFromIndex]
|
|
7083
7100
|
* @param {boolean} [args.nonBlocking]
|
|
7084
7101
|
* @param {number} [args.batchSize]
|
|
7085
7102
|
*
|
|
@@ -7101,6 +7118,7 @@ async function _checkout({
|
|
|
7101
7118
|
dryRun,
|
|
7102
7119
|
force,
|
|
7103
7120
|
track = true,
|
|
7121
|
+
restoreFromIndex = false,
|
|
7104
7122
|
nonBlocking = false,
|
|
7105
7123
|
batchSize = 100,
|
|
7106
7124
|
}) {
|
|
@@ -7160,6 +7178,7 @@ async function _checkout({
|
|
|
7160
7178
|
ref,
|
|
7161
7179
|
force,
|
|
7162
7180
|
filepaths,
|
|
7181
|
+
restoreFromIndex,
|
|
7163
7182
|
});
|
|
7164
7183
|
} catch (err) {
|
|
7165
7184
|
// Throw a more helpful error message for this common mistake.
|
|
@@ -7452,6 +7471,7 @@ async function analyze({
|
|
|
7452
7471
|
ref,
|
|
7453
7472
|
force,
|
|
7454
7473
|
filepaths,
|
|
7474
|
+
restoreFromIndex,
|
|
7455
7475
|
}) {
|
|
7456
7476
|
let count = 0;
|
|
7457
7477
|
return _walk({
|
|
@@ -7459,7 +7479,7 @@ async function analyze({
|
|
|
7459
7479
|
cache,
|
|
7460
7480
|
dir,
|
|
7461
7481
|
gitdir,
|
|
7462
|
-
trees: [TREE({ ref }), WORKDIR(), STAGE()],
|
|
7482
|
+
trees: [restoreFromIndex ? STAGE() : TREE({ ref }), WORKDIR(), STAGE()],
|
|
7463
7483
|
map: async function (fullpath, [commit, workdir, stage]) {
|
|
7464
7484
|
if (fullpath === '.') return
|
|
7465
7485
|
// match against base paths
|
|
@@ -7484,7 +7504,12 @@ async function analyze({
|
|
|
7484
7504
|
// Ignore workdir files that are not tracked and not part of the new commit.
|
|
7485
7505
|
case '001':
|
|
7486
7506
|
// OK, make an exception for explicitly named files.
|
|
7487
|
-
if (
|
|
7507
|
+
if (
|
|
7508
|
+
!restoreFromIndex &&
|
|
7509
|
+
force &&
|
|
7510
|
+
filepaths &&
|
|
7511
|
+
filepaths.includes(fullpath)
|
|
7512
|
+
) {
|
|
7488
7513
|
return ['delete', fullpath]
|
|
7489
7514
|
}
|
|
7490
7515
|
return
|
|
@@ -7827,7 +7852,7 @@ async function batchAllSettled(operationName, tasks, onProgress, batchSize) {
|
|
|
7827
7852
|
* @param {string} args.dir - The [working tree](dir-vs-gitdir.md) directory path
|
|
7828
7853
|
* @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
|
|
7829
7854
|
* @param {string} [args.ref = 'HEAD'] - Source to checkout files from
|
|
7830
|
-
* @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories
|
|
7855
|
+
* @param {string[]} [args.filepaths] - Limit the checkout to the given files and directories. If `ref` is not provided, restore them from the index.
|
|
7831
7856
|
* @param {string} [args.remote = 'origin'] - Which remote repository to use
|
|
7832
7857
|
* @param {boolean} [args.noCheckout = false] - If true, will update HEAD but won't update the working directory
|
|
7833
7858
|
* @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 +7875,7 @@ async function batchAllSettled(operationName, tasks, onProgress, batchSize) {
|
|
|
7850
7875
|
* console.log('done')
|
|
7851
7876
|
*
|
|
7852
7877
|
* @example
|
|
7853
|
-
* // restore the 'docs' and 'src/docs' folders
|
|
7878
|
+
* // restore the 'docs' and 'src/docs' folders from the index, overwriting any unstaged changes
|
|
7854
7879
|
* await git.checkout({
|
|
7855
7880
|
* fs,
|
|
7856
7881
|
* dir: '/tutorial',
|
|
@@ -7895,6 +7920,8 @@ async function checkout({
|
|
|
7895
7920
|
assertParameter('gitdir', gitdir);
|
|
7896
7921
|
|
|
7897
7922
|
const ref = _ref || 'HEAD';
|
|
7923
|
+
const restoreFromIndex =
|
|
7924
|
+
_ref === undefined && filepaths != null && filepaths.length > 0;
|
|
7898
7925
|
const fsp = new FileSystem(fs);
|
|
7899
7926
|
const updatedGitdir = await discoverGitdir({ fsp, dotgit: gitdir });
|
|
7900
7927
|
return await _checkout({
|
|
@@ -7912,6 +7939,7 @@ async function checkout({
|
|
|
7912
7939
|
dryRun,
|
|
7913
7940
|
force,
|
|
7914
7941
|
track,
|
|
7942
|
+
restoreFromIndex,
|
|
7915
7943
|
nonBlocking,
|
|
7916
7944
|
batchSize,
|
|
7917
7945
|
})
|
|
@@ -9687,8 +9715,8 @@ function filterCapabilities(server, client) {
|
|
|
9687
9715
|
|
|
9688
9716
|
const pkg = {
|
|
9689
9717
|
name: 'isomorphic-git',
|
|
9690
|
-
version: '1.41.
|
|
9691
|
-
agent: 'git/isomorphic-git@1.41.
|
|
9718
|
+
version: '1.41.5',
|
|
9719
|
+
agent: 'git/isomorphic-git@1.41.5',
|
|
9692
9720
|
};
|
|
9693
9721
|
|
|
9694
9722
|
class FIFO {
|
|
@@ -13302,6 +13330,7 @@ async function _log({
|
|
|
13302
13330
|
const oid = await GitRefManager.resolve({ fs, gitdir, ref });
|
|
13303
13331
|
const tips = [await _readCommit({ fs, cache, gitdir, oid })];
|
|
13304
13332
|
let lastFileOid;
|
|
13333
|
+
let lastFileMode;
|
|
13305
13334
|
let lastCommit;
|
|
13306
13335
|
let isOk;
|
|
13307
13336
|
|
|
@@ -13321,19 +13350,23 @@ async function _log({
|
|
|
13321
13350
|
}
|
|
13322
13351
|
|
|
13323
13352
|
if (filepath) {
|
|
13324
|
-
let
|
|
13353
|
+
let vFileEntry;
|
|
13325
13354
|
try {
|
|
13326
|
-
|
|
13355
|
+
vFileEntry = await resolveFilepathEntry({
|
|
13327
13356
|
fs,
|
|
13328
13357
|
cache,
|
|
13329
13358
|
gitdir,
|
|
13330
13359
|
oid: commit.commit.tree,
|
|
13331
13360
|
filepath,
|
|
13332
13361
|
});
|
|
13333
|
-
if (
|
|
13362
|
+
if (
|
|
13363
|
+
lastCommit &&
|
|
13364
|
+
(lastFileOid !== vFileEntry.oid || lastFileMode !== vFileEntry.mode)
|
|
13365
|
+
) {
|
|
13334
13366
|
commits.push(lastCommit);
|
|
13335
13367
|
}
|
|
13336
|
-
lastFileOid =
|
|
13368
|
+
lastFileOid = vFileEntry.oid;
|
|
13369
|
+
lastFileMode = vFileEntry.mode;
|
|
13337
13370
|
lastCommit = commit;
|
|
13338
13371
|
isOk = true;
|
|
13339
13372
|
} catch (e) {
|
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',
|