isomorphic-git 1.37.8 → 1.38.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  <p align="center">
2
- <img src="https://raw.githubusercontent.com/isomorphic-git/isomorphic-git/main/website/static/img/isomorphic-git-logo.svg?sanitize=true" alt="" height="150"/>
2
+ <a href="https://isomorphic-git.org/" target="_blank" rel="noopener">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="https://github.com/isomorphic-git/isomorphic-git/blob/main/.github/images/isomorphic-git-dark.svg?raw=true" />
5
+ <source media="(prefers-color-scheme: light)" srcset="https://github.com/isomorphic-git/isomorphic-git/blob/main/.github/images/isomorphic-git-light.svg?raw=true" />
6
+ <img alt="Isomorphic Git logo" src="https://github.com/isomorphic-git/isomorphic-git/blob/main/.github/images/isomorphic-git-light.svg?raw=true" height="150" />
7
+ </picture>
8
+ </a>
3
9
  </p>
4
10
 
5
11
  # isomorphic-git
@@ -281,7 +287,23 @@ Cross-browser device testing is provided by:
281
287
 
282
288
  [![BrowserStack](https://user-images.githubusercontent.com/587740/39730261-9c65c4d8-522e-11e8-9f12-16b349377a35.png)](http://browserstack.com/)
283
289
 
284
- [![SauceLabs](https://saucelabs.com/content/images/logo.png)](https://saucelabs.com)
290
+ <a href="https://saucelabs.com" target="_blank" rel="noopener">
291
+ <picture>
292
+ <source media="(prefers-color-scheme: dark)" srcset="https://saucelabs.com/images/logo-white.svg" />
293
+ <source media="(prefers-color-scheme: light)" srcset="https://saucelabs.com/images/logo.svg" />
294
+ <img alt="Sauce Labs logo" src="https://saucelabs.com/images/logo.svg" height="40" />
295
+ </picture>
296
+ </a>
297
+
298
+ Code Review AI provided by:
299
+
300
+ <a href="https://coderabbit.ai" target="_blank" rel="noopener">
301
+ <picture>
302
+ <source media="(prefers-color-scheme: dark)" srcset="https://github.com/isomorphic-git/isomorphic-git/blob/main/.github/images/coderabbit-dark.svg?raw=true" />
303
+ <source media="(prefers-color-scheme: light)" srcset="https://github.com/isomorphic-git/isomorphic-git/blob/main/.github/images/coderabbit-light.svg?raw=true" />
304
+ <img alt="CodeRabbit logo" src="https://github.com/isomorphic-git/isomorphic-git/blob/main/.github/images/coderabbit-light.svg?raw=true" height="40" />
305
+ </picture>
306
+ </a>
285
307
 
286
308
  ## Contributors
287
309
 
@@ -411,6 +433,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
411
433
  <tr>
412
434
  <td align="center"><a href="https://github.com/N0zoM1z0"><img src="https://avatars.githubusercontent.com/u/161784452?v=4?s=60" width="60px;" alt=""/><br /><sub><b>N0zoM1z0</b></sub></a><br /><a href="#security-N0zoM1z0" title="Security">🛡️</a></td>
413
435
  <td align="center"><a href="https://github.com/amxmln"><img src="https://avatars.githubusercontent.com/u/15271679?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Amadeus Maximilian</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=amxmln" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/issues?q=author%3Aamxmln" title="Bug reports">🐛</a></td>
436
+ <td align="center"><a href="http://toxik.us/"><img src="https://avatars.githubusercontent.com/u/235319?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Alexandru Georoceanu</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=toxik" title="Code">💻</a></td>
414
437
  </tr>
415
438
  </table>
416
439
 
package/index.cjs CHANGED
@@ -4510,11 +4510,12 @@ function TREE({ ref = 'HEAD' } = {}) {
4510
4510
  // @ts-check
4511
4511
 
4512
4512
  class GitWalkerFs {
4513
- constructor({ fs, dir, gitdir, cache }) {
4513
+ constructor({ fs, dir, gitdir, cache, refresh = true }) {
4514
4514
  this.fs = fs;
4515
4515
  this.cache = cache;
4516
4516
  this.dir = dir;
4517
4517
  this.gitdir = gitdir;
4518
+ this.refresh = refresh;
4518
4519
 
4519
4520
  this.config = null;
4520
4521
  const walker = this;
@@ -4650,7 +4651,9 @@ class GitWalkerFs {
4650
4651
  // Update the stats in the index so we will get a "cache hit" next time
4651
4652
  // 1) if we can (because the oid and mode are the same)
4652
4653
  // 2) and only if we need to (because other stats differ)
4654
+ // 3) and only if the caller opted in to refreshing the index
4653
4655
  if (
4656
+ self.refresh &&
4654
4657
  stage &&
4655
4658
  oid === stage.oid &&
4656
4659
  (!filemode || stats.mode === stage.mode) &&
@@ -4686,13 +4689,17 @@ class GitWalkerFs {
4686
4689
  // @ts-check
4687
4690
 
4688
4691
  /**
4692
+ * @param {object} [opts]
4693
+ * @param {boolean} [opts.refresh=true] - When false, suppress the stat-cache
4694
+ * refresh that would rewrite `.git/index` when a working-tree file's stat
4695
+ * info has drifted but its content still matches the staged blob.
4689
4696
  * @returns {Walker}
4690
4697
  */
4691
- function WORKDIR() {
4698
+ function WORKDIR({ refresh = true } = {}) {
4692
4699
  const o = Object.create(null);
4693
4700
  Object.defineProperty(o, GitWalkSymbol, {
4694
4701
  value: function ({ fs, dir, gitdir, cache }) {
4695
- return new GitWalkerFs({ fs, dir, gitdir, cache })
4702
+ return new GitWalkerFs({ fs, dir, gitdir, cache, refresh })
4696
4703
  },
4697
4704
  });
4698
4705
  Object.freeze(o);
@@ -9343,8 +9350,8 @@ function filterCapabilities(server, client) {
9343
9350
 
9344
9351
  const pkg = {
9345
9352
  name: 'isomorphic-git',
9346
- version: '1.37.8',
9347
- agent: 'git/isomorphic-git@1.37.8',
9353
+ version: '1.38.0',
9354
+ agent: 'git/isomorphic-git@1.38.0',
9348
9355
  };
9349
9356
 
9350
9357
  class FIFO {
@@ -16044,6 +16051,11 @@ async function stash({
16044
16051
  * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
16045
16052
  * @param {string} args.filepath - The path to the file to query
16046
16053
  * @param {object} [args.cache] - a [cache](cache.md) object
16054
+ * @param {boolean} [args.refresh = true] - when false, do not refresh the
16055
+ * `.git/index` stat cache when the working-tree file's contents still match
16056
+ * the staged blob. The call becomes read-only with respect to the index, at
16057
+ * the cost of recomputing the SHA1 on subsequent calls for files whose
16058
+ * stat info has drifted.
16047
16059
  *
16048
16060
  * @returns {Promise<'ignored'|'unmodified'|'*modified'|'*deleted'|'*added'|'absent'|'modified'|'deleted'|'added'|'*unmodified'|'*absent'|'*undeleted'|'*undeletemodified'>} Resolves successfully with the file's git status
16049
16061
  *
@@ -16058,6 +16070,7 @@ async function status({
16058
16070
  gitdir = join(dir, '.git'),
16059
16071
  filepath,
16060
16072
  cache = {},
16073
+ refresh = true,
16061
16074
  }) {
16062
16075
  try {
16063
16076
  assertParameter('fs', _fs);
@@ -16109,7 +16122,7 @@ async function status({
16109
16122
  object,
16110
16123
  });
16111
16124
  // If the oid in the index === working dir oid but stats differed update cache
16112
- if (I && indexEntry.oid === workdirOid) {
16125
+ if (refresh && I && indexEntry.oid === workdirOid) {
16113
16126
  // and as long as our fs.stats aren't bad.
16114
16127
  // size of -1 happens over a BrowserFS HTTP Backend that doesn't serve Content-Length headers
16115
16128
  // (like the Karma webserver) because BrowserFS HTTP Backend uses HTTP HEAD requests to do fs.stat
@@ -16362,6 +16375,11 @@ async function getHeadTree({ fs, cache, gitdir: updatedGitdir }) {
16362
16375
  * @param {function(string): boolean} [args.filter] - Filter the results to only those whose filepath matches a function.
16363
16376
  * @param {object} [args.cache] - a [cache](cache.md) object
16364
16377
  * @param {boolean} [args.ignored = false] - include ignored files in the result
16378
+ * @param {boolean} [args.refresh = true] - when false, do not refresh the
16379
+ * `.git/index` stat cache for files whose contents still match the staged
16380
+ * blob. The call becomes read-only with respect to the index, at the cost
16381
+ * of recomputing the SHA1 on subsequent calls for files whose stat info
16382
+ * has drifted.
16365
16383
  *
16366
16384
  * @returns {Promise<Array<StatusRow>>} Resolves with a status matrix, described below.
16367
16385
  * @see StatusRow
@@ -16375,6 +16393,7 @@ async function statusMatrix({
16375
16393
  filter,
16376
16394
  cache = {},
16377
16395
  ignored: shouldIgnore = false,
16396
+ refresh = true,
16378
16397
  }) {
16379
16398
  try {
16380
16399
  assertParameter('fs', _fs);
@@ -16388,7 +16407,7 @@ async function statusMatrix({
16388
16407
  cache,
16389
16408
  dir,
16390
16409
  gitdir: updatedGitdir,
16391
- trees: [TREE({ ref }), WORKDIR(), STAGE()],
16410
+ trees: [TREE({ ref }), WORKDIR({ refresh }), STAGE()],
16392
16411
  map: async function (filepath, [head, workdir, stage]) {
16393
16412
  // Ignore ignored files, but only if they are not already tracked.
16394
16413
  if (!head && !stage && workdir) {
package/index.d.cts CHANGED
@@ -675,9 +675,15 @@ export function TREE({ ref }?: {
675
675
  ref?: string | undefined;
676
676
  }): Walker;
677
677
  /**
678
+ * @param {object} [opts]
679
+ * @param {boolean} [opts.refresh=true] - When false, suppress the stat-cache
680
+ * refresh that would rewrite `.git/index` when a working-tree file's stat
681
+ * info has drifted but its content still matches the staged blob.
678
682
  * @returns {Walker}
679
683
  */
680
- export function WORKDIR(): Walker;
684
+ export function WORKDIR({ refresh }?: {
685
+ refresh?: boolean | undefined;
686
+ }): Walker;
681
687
  /**
682
688
  * Abort a merge in progress.
683
689
  *
@@ -3173,6 +3179,11 @@ export function stash({ fs, dir, gitdir, op, message, refIdx, }: {
3173
3179
  * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
3174
3180
  * @param {string} args.filepath - The path to the file to query
3175
3181
  * @param {object} [args.cache] - a [cache](cache.md) object
3182
+ * @param {boolean} [args.refresh = true] - when false, do not refresh the
3183
+ * `.git/index` stat cache when the working-tree file's contents still match
3184
+ * the staged blob. The call becomes read-only with respect to the index, at
3185
+ * the cost of recomputing the SHA1 on subsequent calls for files whose
3186
+ * stat info has drifted.
3176
3187
  *
3177
3188
  * @returns {Promise<'ignored'|'unmodified'|'*modified'|'*deleted'|'*added'|'absent'|'modified'|'deleted'|'added'|'*unmodified'|'*absent'|'*undeleted'|'*undeletemodified'>} Resolves successfully with the file's git status
3178
3189
  *
@@ -3181,12 +3192,13 @@ export function stash({ fs, dir, gitdir, op, message, refIdx, }: {
3181
3192
  * console.log(status)
3182
3193
  *
3183
3194
  */
3184
- export function status({ fs: _fs, dir, gitdir, filepath, cache, }: {
3195
+ export function status({ fs: _fs, dir, gitdir, filepath, cache, refresh, }: {
3185
3196
  fs: FsClient;
3186
3197
  dir: string;
3187
3198
  gitdir?: string | undefined;
3188
3199
  filepath: string;
3189
3200
  cache?: object;
3201
+ refresh?: boolean | undefined;
3190
3202
  }): Promise<"ignored" | "unmodified" | "*modified" | "*deleted" | "*added" | "absent" | "modified" | "deleted" | "added" | "*unmodified" | "*absent" | "*undeleted" | "*undeletemodified">;
3191
3203
  /**
3192
3204
  * Efficiently get the status of multiple files at once.
@@ -3327,11 +3339,16 @@ export function status({ fs: _fs, dir, gitdir, filepath, cache, }: {
3327
3339
  * @param {function(string): boolean} [args.filter] - Filter the results to only those whose filepath matches a function.
3328
3340
  * @param {object} [args.cache] - a [cache](cache.md) object
3329
3341
  * @param {boolean} [args.ignored = false] - include ignored files in the result
3342
+ * @param {boolean} [args.refresh = true] - when false, do not refresh the
3343
+ * `.git/index` stat cache for files whose contents still match the staged
3344
+ * blob. The call becomes read-only with respect to the index, at the cost
3345
+ * of recomputing the SHA1 on subsequent calls for files whose stat info
3346
+ * has drifted.
3330
3347
  *
3331
3348
  * @returns {Promise<Array<StatusRow>>} Resolves with a status matrix, described below.
3332
3349
  * @see StatusRow
3333
3350
  */
3334
- export function statusMatrix({ fs: _fs, dir, gitdir, ref, filepaths, filter, cache, ignored: shouldIgnore, }: {
3351
+ export function statusMatrix({ fs: _fs, dir, gitdir, ref, filepaths, filter, cache, ignored: shouldIgnore, refresh, }: {
3335
3352
  fs: FsClient;
3336
3353
  dir: string;
3337
3354
  gitdir?: string | undefined;
@@ -3340,6 +3357,7 @@ export function statusMatrix({ fs: _fs, dir, gitdir, ref, filepaths, filter, cac
3340
3357
  filter?: ((arg0: string) => boolean) | undefined;
3341
3358
  cache?: object;
3342
3359
  ignored?: boolean | undefined;
3360
+ refresh?: boolean | undefined;
3343
3361
  }): Promise<Array<StatusRow>>;
3344
3362
  /**
3345
3363
  * Create a lightweight tag
package/index.d.ts CHANGED
@@ -747,9 +747,15 @@ export function TREE({ ref }?: {
747
747
  ref?: string | undefined;
748
748
  }): Walker;
749
749
  /**
750
+ * @param {object} [opts]
751
+ * @param {boolean} [opts.refresh=true] - When false, suppress the stat-cache
752
+ * refresh that would rewrite `.git/index` when a working-tree file's stat
753
+ * info has drifted but its content still matches the staged blob.
750
754
  * @returns {Walker}
751
755
  */
752
- export function WORKDIR(): Walker;
756
+ export function WORKDIR({ refresh }?: {
757
+ refresh?: boolean | undefined;
758
+ }): Walker;
753
759
  /**
754
760
  * Abort a merge in progress.
755
761
  *
@@ -3172,6 +3178,11 @@ export function stash({ fs, dir, gitdir, op, message, refIdx, }: {
3172
3178
  * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
3173
3179
  * @param {string} args.filepath - The path to the file to query
3174
3180
  * @param {object} [args.cache] - a [cache](cache.md) object
3181
+ * @param {boolean} [args.refresh = true] - when false, do not refresh the
3182
+ * `.git/index` stat cache when the working-tree file's contents still match
3183
+ * the staged blob. The call becomes read-only with respect to the index, at
3184
+ * the cost of recomputing the SHA1 on subsequent calls for files whose
3185
+ * stat info has drifted.
3175
3186
  *
3176
3187
  * @returns {Promise<'ignored'|'unmodified'|'*modified'|'*deleted'|'*added'|'absent'|'modified'|'deleted'|'added'|'*unmodified'|'*absent'|'*undeleted'|'*undeletemodified'>} Resolves successfully with the file's git status
3177
3188
  *
@@ -3180,12 +3191,13 @@ export function stash({ fs, dir, gitdir, op, message, refIdx, }: {
3180
3191
  * console.log(status)
3181
3192
  *
3182
3193
  */
3183
- export function status({ fs: _fs, dir, gitdir, filepath, cache, }: {
3194
+ export function status({ fs: _fs, dir, gitdir, filepath, cache, refresh, }: {
3184
3195
  fs: FsClient;
3185
3196
  dir: string;
3186
3197
  gitdir?: string | undefined;
3187
3198
  filepath: string;
3188
3199
  cache?: object;
3200
+ refresh?: boolean | undefined;
3189
3201
  }): Promise<"ignored" | "unmodified" | "*modified" | "*deleted" | "*added" | "absent" | "modified" | "deleted" | "added" | "*unmodified" | "*absent" | "*undeleted" | "*undeletemodified">;
3190
3202
  /**
3191
3203
  * Efficiently get the status of multiple files at once.
@@ -3326,11 +3338,16 @@ export function status({ fs: _fs, dir, gitdir, filepath, cache, }: {
3326
3338
  * @param {function(string): boolean} [args.filter] - Filter the results to only those whose filepath matches a function.
3327
3339
  * @param {object} [args.cache] - a [cache](cache.md) object
3328
3340
  * @param {boolean} [args.ignored = false] - include ignored files in the result
3341
+ * @param {boolean} [args.refresh = true] - when false, do not refresh the
3342
+ * `.git/index` stat cache for files whose contents still match the staged
3343
+ * blob. The call becomes read-only with respect to the index, at the cost
3344
+ * of recomputing the SHA1 on subsequent calls for files whose stat info
3345
+ * has drifted.
3329
3346
  *
3330
3347
  * @returns {Promise<Array<StatusRow>>} Resolves with a status matrix, described below.
3331
3348
  * @see StatusRow
3332
3349
  */
3333
- export function statusMatrix({ fs: _fs, dir, gitdir, ref, filepaths, filter, cache, ignored: shouldIgnore, }: {
3350
+ export function statusMatrix({ fs: _fs, dir, gitdir, ref, filepaths, filter, cache, ignored: shouldIgnore, refresh, }: {
3334
3351
  fs: FsClient;
3335
3352
  dir: string;
3336
3353
  gitdir?: string | undefined;
@@ -3339,6 +3356,7 @@ export function statusMatrix({ fs: _fs, dir, gitdir, ref, filepaths, filter, cac
3339
3356
  filter?: ((arg0: string) => boolean) | undefined;
3340
3357
  cache?: object;
3341
3358
  ignored?: boolean | undefined;
3359
+ refresh?: boolean | undefined;
3342
3360
  }): Promise<Array<StatusRow>>;
3343
3361
  /**
3344
3362
  * Create a lightweight tag
package/index.js CHANGED
@@ -4497,11 +4497,12 @@ function TREE({ ref = 'HEAD' } = {}) {
4497
4497
  // @ts-check
4498
4498
 
4499
4499
  class GitWalkerFs {
4500
- constructor({ fs, dir, gitdir, cache }) {
4500
+ constructor({ fs, dir, gitdir, cache, refresh = true }) {
4501
4501
  this.fs = fs;
4502
4502
  this.cache = cache;
4503
4503
  this.dir = dir;
4504
4504
  this.gitdir = gitdir;
4505
+ this.refresh = refresh;
4505
4506
 
4506
4507
  this.config = null;
4507
4508
  const walker = this;
@@ -4637,7 +4638,9 @@ class GitWalkerFs {
4637
4638
  // Update the stats in the index so we will get a "cache hit" next time
4638
4639
  // 1) if we can (because the oid and mode are the same)
4639
4640
  // 2) and only if we need to (because other stats differ)
4641
+ // 3) and only if the caller opted in to refreshing the index
4640
4642
  if (
4643
+ self.refresh &&
4641
4644
  stage &&
4642
4645
  oid === stage.oid &&
4643
4646
  (!filemode || stats.mode === stage.mode) &&
@@ -4673,13 +4676,17 @@ class GitWalkerFs {
4673
4676
  // @ts-check
4674
4677
 
4675
4678
  /**
4679
+ * @param {object} [opts]
4680
+ * @param {boolean} [opts.refresh=true] - When false, suppress the stat-cache
4681
+ * refresh that would rewrite `.git/index` when a working-tree file's stat
4682
+ * info has drifted but its content still matches the staged blob.
4676
4683
  * @returns {Walker}
4677
4684
  */
4678
- function WORKDIR() {
4685
+ function WORKDIR({ refresh = true } = {}) {
4679
4686
  const o = Object.create(null);
4680
4687
  Object.defineProperty(o, GitWalkSymbol, {
4681
4688
  value: function ({ fs, dir, gitdir, cache }) {
4682
- return new GitWalkerFs({ fs, dir, gitdir, cache })
4689
+ return new GitWalkerFs({ fs, dir, gitdir, cache, refresh })
4683
4690
  },
4684
4691
  });
4685
4692
  Object.freeze(o);
@@ -9330,8 +9337,8 @@ function filterCapabilities(server, client) {
9330
9337
 
9331
9338
  const pkg = {
9332
9339
  name: 'isomorphic-git',
9333
- version: '1.37.8',
9334
- agent: 'git/isomorphic-git@1.37.8',
9340
+ version: '1.38.0',
9341
+ agent: 'git/isomorphic-git@1.38.0',
9335
9342
  };
9336
9343
 
9337
9344
  class FIFO {
@@ -16031,6 +16038,11 @@ async function stash({
16031
16038
  * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
16032
16039
  * @param {string} args.filepath - The path to the file to query
16033
16040
  * @param {object} [args.cache] - a [cache](cache.md) object
16041
+ * @param {boolean} [args.refresh = true] - when false, do not refresh the
16042
+ * `.git/index` stat cache when the working-tree file's contents still match
16043
+ * the staged blob. The call becomes read-only with respect to the index, at
16044
+ * the cost of recomputing the SHA1 on subsequent calls for files whose
16045
+ * stat info has drifted.
16034
16046
  *
16035
16047
  * @returns {Promise<'ignored'|'unmodified'|'*modified'|'*deleted'|'*added'|'absent'|'modified'|'deleted'|'added'|'*unmodified'|'*absent'|'*undeleted'|'*undeletemodified'>} Resolves successfully with the file's git status
16036
16048
  *
@@ -16045,6 +16057,7 @@ async function status({
16045
16057
  gitdir = join(dir, '.git'),
16046
16058
  filepath,
16047
16059
  cache = {},
16060
+ refresh = true,
16048
16061
  }) {
16049
16062
  try {
16050
16063
  assertParameter('fs', _fs);
@@ -16096,7 +16109,7 @@ async function status({
16096
16109
  object,
16097
16110
  });
16098
16111
  // If the oid in the index === working dir oid but stats differed update cache
16099
- if (I && indexEntry.oid === workdirOid) {
16112
+ if (refresh && I && indexEntry.oid === workdirOid) {
16100
16113
  // and as long as our fs.stats aren't bad.
16101
16114
  // size of -1 happens over a BrowserFS HTTP Backend that doesn't serve Content-Length headers
16102
16115
  // (like the Karma webserver) because BrowserFS HTTP Backend uses HTTP HEAD requests to do fs.stat
@@ -16349,6 +16362,11 @@ async function getHeadTree({ fs, cache, gitdir: updatedGitdir }) {
16349
16362
  * @param {function(string): boolean} [args.filter] - Filter the results to only those whose filepath matches a function.
16350
16363
  * @param {object} [args.cache] - a [cache](cache.md) object
16351
16364
  * @param {boolean} [args.ignored = false] - include ignored files in the result
16365
+ * @param {boolean} [args.refresh = true] - when false, do not refresh the
16366
+ * `.git/index` stat cache for files whose contents still match the staged
16367
+ * blob. The call becomes read-only with respect to the index, at the cost
16368
+ * of recomputing the SHA1 on subsequent calls for files whose stat info
16369
+ * has drifted.
16352
16370
  *
16353
16371
  * @returns {Promise<Array<StatusRow>>} Resolves with a status matrix, described below.
16354
16372
  * @see StatusRow
@@ -16362,6 +16380,7 @@ async function statusMatrix({
16362
16380
  filter,
16363
16381
  cache = {},
16364
16382
  ignored: shouldIgnore = false,
16383
+ refresh = true,
16365
16384
  }) {
16366
16385
  try {
16367
16386
  assertParameter('fs', _fs);
@@ -16375,7 +16394,7 @@ async function statusMatrix({
16375
16394
  cache,
16376
16395
  dir,
16377
16396
  gitdir: updatedGitdir,
16378
- trees: [TREE({ ref }), WORKDIR(), STAGE()],
16397
+ trees: [TREE({ ref }), WORKDIR({ refresh }), STAGE()],
16379
16398
  map: async function (filepath, [head, workdir, stage]) {
16380
16399
  // Ignore ignored files, but only if they are not already tracked.
16381
16400
  if (!head && !stage && workdir) {
@@ -747,9 +747,15 @@ export function TREE({ ref }?: {
747
747
  ref?: string | undefined;
748
748
  }): Walker;
749
749
  /**
750
+ * @param {object} [opts]
751
+ * @param {boolean} [opts.refresh=true] - When false, suppress the stat-cache
752
+ * refresh that would rewrite `.git/index` when a working-tree file's stat
753
+ * info has drifted but its content still matches the staged blob.
750
754
  * @returns {Walker}
751
755
  */
752
- export function WORKDIR(): Walker;
756
+ export function WORKDIR({ refresh }?: {
757
+ refresh?: boolean | undefined;
758
+ }): Walker;
753
759
  /**
754
760
  * Abort a merge in progress.
755
761
  *
@@ -3172,6 +3178,11 @@ export function stash({ fs, dir, gitdir, op, message, refIdx, }: {
3172
3178
  * @param {string} [args.gitdir=join(dir, '.git')] - [required] The [git directory](dir-vs-gitdir.md) path
3173
3179
  * @param {string} args.filepath - The path to the file to query
3174
3180
  * @param {object} [args.cache] - a [cache](cache.md) object
3181
+ * @param {boolean} [args.refresh = true] - when false, do not refresh the
3182
+ * `.git/index` stat cache when the working-tree file's contents still match
3183
+ * the staged blob. The call becomes read-only with respect to the index, at
3184
+ * the cost of recomputing the SHA1 on subsequent calls for files whose
3185
+ * stat info has drifted.
3175
3186
  *
3176
3187
  * @returns {Promise<'ignored'|'unmodified'|'*modified'|'*deleted'|'*added'|'absent'|'modified'|'deleted'|'added'|'*unmodified'|'*absent'|'*undeleted'|'*undeletemodified'>} Resolves successfully with the file's git status
3177
3188
  *
@@ -3180,12 +3191,13 @@ export function stash({ fs, dir, gitdir, op, message, refIdx, }: {
3180
3191
  * console.log(status)
3181
3192
  *
3182
3193
  */
3183
- export function status({ fs: _fs, dir, gitdir, filepath, cache, }: {
3194
+ export function status({ fs: _fs, dir, gitdir, filepath, cache, refresh, }: {
3184
3195
  fs: FsClient;
3185
3196
  dir: string;
3186
3197
  gitdir?: string | undefined;
3187
3198
  filepath: string;
3188
3199
  cache?: object;
3200
+ refresh?: boolean | undefined;
3189
3201
  }): Promise<"ignored" | "unmodified" | "*modified" | "*deleted" | "*added" | "absent" | "modified" | "deleted" | "added" | "*unmodified" | "*absent" | "*undeleted" | "*undeletemodified">;
3190
3202
  /**
3191
3203
  * Efficiently get the status of multiple files at once.
@@ -3326,11 +3338,16 @@ export function status({ fs: _fs, dir, gitdir, filepath, cache, }: {
3326
3338
  * @param {function(string): boolean} [args.filter] - Filter the results to only those whose filepath matches a function.
3327
3339
  * @param {object} [args.cache] - a [cache](cache.md) object
3328
3340
  * @param {boolean} [args.ignored = false] - include ignored files in the result
3341
+ * @param {boolean} [args.refresh = true] - when false, do not refresh the
3342
+ * `.git/index` stat cache for files whose contents still match the staged
3343
+ * blob. The call becomes read-only with respect to the index, at the cost
3344
+ * of recomputing the SHA1 on subsequent calls for files whose stat info
3345
+ * has drifted.
3329
3346
  *
3330
3347
  * @returns {Promise<Array<StatusRow>>} Resolves with a status matrix, described below.
3331
3348
  * @see StatusRow
3332
3349
  */
3333
- export function statusMatrix({ fs: _fs, dir, gitdir, ref, filepaths, filter, cache, ignored: shouldIgnore, }: {
3350
+ export function statusMatrix({ fs: _fs, dir, gitdir, ref, filepaths, filter, cache, ignored: shouldIgnore, refresh, }: {
3334
3351
  fs: FsClient;
3335
3352
  dir: string;
3336
3353
  gitdir?: string | undefined;
@@ -3339,6 +3356,7 @@ export function statusMatrix({ fs: _fs, dir, gitdir, ref, filepaths, filter, cac
3339
3356
  filter?: ((arg0: string) => boolean) | undefined;
3340
3357
  cache?: object;
3341
3358
  ignored?: boolean | undefined;
3359
+ refresh?: boolean | undefined;
3342
3360
  }): Promise<Array<StatusRow>>;
3343
3361
  /**
3344
3362
  * Create a lightweight tag