isomorphic-git 1.37.9 → 1.38.1
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 +35 -2
- package/index.cjs +26 -7
- package/index.d.cts +21 -3
- package/index.d.ts +21 -3
- package/index.js +26 -7
- package/index.umd.min.d.ts +21 -3
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/managers/index.cjs +10 -3
- package/managers/index.js +10 -3
- package/package.json +1 -1
package/managers/index.cjs
CHANGED
|
@@ -5382,11 +5382,12 @@ function TREE({ ref = 'HEAD' } = {}) {
|
|
|
5382
5382
|
}
|
|
5383
5383
|
|
|
5384
5384
|
class GitWalkerFs {
|
|
5385
|
-
constructor({ fs, dir, gitdir, cache }) {
|
|
5385
|
+
constructor({ fs, dir, gitdir, cache, refresh = true }) {
|
|
5386
5386
|
this.fs = fs;
|
|
5387
5387
|
this.cache = cache;
|
|
5388
5388
|
this.dir = dir;
|
|
5389
5389
|
this.gitdir = gitdir;
|
|
5390
|
+
this.refresh = refresh;
|
|
5390
5391
|
|
|
5391
5392
|
this.config = null;
|
|
5392
5393
|
const walker = this;
|
|
@@ -5522,7 +5523,9 @@ class GitWalkerFs {
|
|
|
5522
5523
|
// Update the stats in the index so we will get a "cache hit" next time
|
|
5523
5524
|
// 1) if we can (because the oid and mode are the same)
|
|
5524
5525
|
// 2) and only if we need to (because other stats differ)
|
|
5526
|
+
// 3) and only if the caller opted in to refreshing the index
|
|
5525
5527
|
if (
|
|
5528
|
+
self.refresh &&
|
|
5526
5529
|
stage &&
|
|
5527
5530
|
oid === stage.oid &&
|
|
5528
5531
|
(!filemode || stats.mode === stage.mode) &&
|
|
@@ -5558,13 +5561,17 @@ class GitWalkerFs {
|
|
|
5558
5561
|
// @ts-check
|
|
5559
5562
|
|
|
5560
5563
|
/**
|
|
5564
|
+
* @param {object} [opts]
|
|
5565
|
+
* @param {boolean} [opts.refresh=true] - When false, suppress the stat-cache
|
|
5566
|
+
* refresh that would rewrite `.git/index` when a working-tree file's stat
|
|
5567
|
+
* info has drifted but its content still matches the staged blob.
|
|
5561
5568
|
* @returns {Walker}
|
|
5562
5569
|
*/
|
|
5563
|
-
function WORKDIR() {
|
|
5570
|
+
function WORKDIR({ refresh = true } = {}) {
|
|
5564
5571
|
const o = Object.create(null);
|
|
5565
5572
|
Object.defineProperty(o, GitWalkSymbol, {
|
|
5566
5573
|
value: function ({ fs, dir, gitdir, cache }) {
|
|
5567
|
-
return new GitWalkerFs({ fs, dir, gitdir, cache })
|
|
5574
|
+
return new GitWalkerFs({ fs, dir, gitdir, cache, refresh })
|
|
5568
5575
|
},
|
|
5569
5576
|
});
|
|
5570
5577
|
Object.freeze(o);
|
package/managers/index.js
CHANGED
|
@@ -5369,11 +5369,12 @@ function TREE({ ref = 'HEAD' } = {}) {
|
|
|
5369
5369
|
}
|
|
5370
5370
|
|
|
5371
5371
|
class GitWalkerFs {
|
|
5372
|
-
constructor({ fs, dir, gitdir, cache }) {
|
|
5372
|
+
constructor({ fs, dir, gitdir, cache, refresh = true }) {
|
|
5373
5373
|
this.fs = fs;
|
|
5374
5374
|
this.cache = cache;
|
|
5375
5375
|
this.dir = dir;
|
|
5376
5376
|
this.gitdir = gitdir;
|
|
5377
|
+
this.refresh = refresh;
|
|
5377
5378
|
|
|
5378
5379
|
this.config = null;
|
|
5379
5380
|
const walker = this;
|
|
@@ -5509,7 +5510,9 @@ class GitWalkerFs {
|
|
|
5509
5510
|
// Update the stats in the index so we will get a "cache hit" next time
|
|
5510
5511
|
// 1) if we can (because the oid and mode are the same)
|
|
5511
5512
|
// 2) and only if we need to (because other stats differ)
|
|
5513
|
+
// 3) and only if the caller opted in to refreshing the index
|
|
5512
5514
|
if (
|
|
5515
|
+
self.refresh &&
|
|
5513
5516
|
stage &&
|
|
5514
5517
|
oid === stage.oid &&
|
|
5515
5518
|
(!filemode || stats.mode === stage.mode) &&
|
|
@@ -5545,13 +5548,17 @@ class GitWalkerFs {
|
|
|
5545
5548
|
// @ts-check
|
|
5546
5549
|
|
|
5547
5550
|
/**
|
|
5551
|
+
* @param {object} [opts]
|
|
5552
|
+
* @param {boolean} [opts.refresh=true] - When false, suppress the stat-cache
|
|
5553
|
+
* refresh that would rewrite `.git/index` when a working-tree file's stat
|
|
5554
|
+
* info has drifted but its content still matches the staged blob.
|
|
5548
5555
|
* @returns {Walker}
|
|
5549
5556
|
*/
|
|
5550
|
-
function WORKDIR() {
|
|
5557
|
+
function WORKDIR({ refresh = true } = {}) {
|
|
5551
5558
|
const o = Object.create(null);
|
|
5552
5559
|
Object.defineProperty(o, GitWalkSymbol, {
|
|
5553
5560
|
value: function ({ fs, dir, gitdir, cache }) {
|
|
5554
|
-
return new GitWalkerFs({ fs, dir, gitdir, cache })
|
|
5561
|
+
return new GitWalkerFs({ fs, dir, gitdir, cache, refresh })
|
|
5555
5562
|
},
|
|
5556
5563
|
});
|
|
5557
5564
|
Object.freeze(o);
|