isomorphic-git 1.33.3 → 1.34.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 CHANGED
@@ -392,7 +392,11 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
392
392
  <td align="center"><a href="https://github.com/gnillev"><img src="https://avatars.githubusercontent.com/u/8965094?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Mathias Nisted Velling</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=gnillev" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=gnillev" title="Tests">⚠️</a></td>
393
393
  <td align="center"><a href="https://github.com/acandoo"><img src="https://avatars.githubusercontent.com/u/117209328?v=4?s=60" width="60px;" alt=""/><br /><sub><b>acandoo</b></sub></a><br /><a href="#platform-acandoo" title="Packaging/porting to new platform">📦</a> <a href="#userTesting-acandoo" title="User Testing">📓</a></td>
394
394
  <td align="center"><a href="https://github.com/bekatan"><img src="https://avatars.githubusercontent.com/u/19550476?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Bekatan Satyev</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=bekatan" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=bekatan" title="Tests">⚠️</a></td>
395
+ </tr>
396
+ <tr>
395
397
  <td align="center"><a href="https://github.com/hemanthkini"><img src="https://avatars.githubusercontent.com/u/3934055?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Hemanth Kini</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=hemanthkini" title="Code">💻</a></td>
398
+ <td align="center"><a href="https://github.com/anish3333"><img src="https://avatars.githubusercontent.com/u/128889867?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Anish Awasthi</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=anish3333" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=anish3333" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=anish3333" title="Tests">⚠️</a></td>
399
+ <td align="center"><a href="https://github.com/fetsorn"><img src="https://avatars.githubusercontent.com/u/12858105?v=4?s=60" width="60px;" alt=""/><br /><sub><b>fetsorn</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=fetsorn" title="Documentation">📖</a></td>
396
400
  </tr>
397
401
  </table>
398
402
 
@@ -1,8 +1,13 @@
1
1
  [
2
2
  "Chrome Headless 79.0.3945.0 (Linux x86_64)",
3
3
  "Firefox 143.0 (Linux x86_64)",
4
- "Chrome 137.0.0.0 (Android 10)",
5
4
  "Mobile Safari 14.0 (iOS 14.0.1)",
6
- "Edge 79.0.309.65 (Windows 10)",
7
- "Safari 14.1 (Mac OS 10.15.7)"
5
+ "Safari 14.1 (Mac OS 10.15.7)",
6
+ "Chrome 139.0.0.0 (Android 10)",
7
+ "X Edge 79.0.309.65 (Windows 10)",
8
+ "X Edge 79.0.309.65 (Windows 10)",
9
+ "X Edge 79.0.309.65 (Windows 10)",
10
+ "X Edge 79.0.309.65 (Windows 10)",
11
+ "Chrome Headless 79.0.3945.0 (Linux x86_64)",
12
+ "Chrome 139.0.0.0 (Android 10)"
8
13
  ]
package/index.cjs CHANGED
@@ -8067,8 +8067,8 @@ function filterCapabilities(server, client) {
8067
8067
 
8068
8068
  const pkg = {
8069
8069
  name: 'isomorphic-git',
8070
- version: '1.33.3',
8071
- agent: 'git/isomorphic-git@1.33.3',
8070
+ version: '1.34.1',
8071
+ agent: 'git/isomorphic-git@1.34.1',
8072
8072
  };
8073
8073
 
8074
8074
  class FIFO {
@@ -15013,8 +15013,7 @@ class GitStashManager {
15013
15013
  return []
15014
15014
  }
15015
15015
 
15016
- const reflogBuffer = await this.fs.read(this.refLogsStashPath);
15017
- const reflogString = reflogBuffer.toString();
15016
+ const reflogString = await this.fs.read(this.refLogsStashPath, 'utf8');
15018
15017
 
15019
15018
  return GitRefStash.getStashReflogEntry(reflogString, parsed)
15020
15019
  }
@@ -15022,7 +15021,11 @@ class GitStashManager {
15022
15021
 
15023
15022
  // @ts-check
15024
15023
 
15025
- async function _stashPush({ fs, dir, gitdir, message = '' }) {
15024
+ /**
15025
+ * Common logic for creating a stash commit
15026
+ * @private
15027
+ */
15028
+ async function _createStashCommit({ fs, dir, gitdir, message = '' }) {
15026
15029
  const stashMgr = new GitStashManager({ fs, dir, gitdir });
15027
15030
 
15028
15031
  await stashMgr.getAuthor(); // ensure there is an author
@@ -15057,7 +15060,7 @@ async function _stashPush({ fs, dir, gitdir, message = '' }) {
15057
15060
  // create a commit from the index tree, which has one parent, the current branch HEAD
15058
15061
  const stashCommitOne = await stashMgr.writeStashCommit({
15059
15062
  message: `stash-Index: WIP on ${branch} - ${new Date().toISOString()}`,
15060
- tree: indexTree, // stashCommitTree
15063
+ tree: indexTree,
15061
15064
  parent: stashCommitParents,
15062
15065
  });
15063
15066
  stashCommitParents.push(stashCommitOne);
@@ -15098,6 +15101,17 @@ async function _stashPush({ fs, dir, gitdir, message = '' }) {
15098
15101
  parent: stashCommitParents,
15099
15102
  });
15100
15103
 
15104
+ return { stashCommit, stashMsg, branch, stashMgr }
15105
+ }
15106
+
15107
+ async function _stashPush({ fs, dir, gitdir, message = '' }) {
15108
+ const { stashCommit, stashMsg, branch, stashMgr } = await _createStashCommit({
15109
+ fs,
15110
+ dir,
15111
+ gitdir,
15112
+ message,
15113
+ });
15114
+
15101
15115
  // next, write this commit into .git/refs/stash:
15102
15116
  await stashMgr.writeStashRef(stashCommit);
15103
15117
 
@@ -15120,6 +15134,18 @@ async function _stashPush({ fs, dir, gitdir, message = '' }) {
15120
15134
  return stashCommit
15121
15135
  }
15122
15136
 
15137
+ async function _stashCreate({ fs, dir, gitdir, message = '' }) {
15138
+ const { stashCommit } = await _createStashCommit({
15139
+ fs,
15140
+ dir,
15141
+ gitdir,
15142
+ message,
15143
+ });
15144
+
15145
+ // Return the stash commit hash without modifying refs or working directory
15146
+ return stashCommit
15147
+ }
15148
+
15123
15149
  async function _stashApply({ fs, dir, gitdir, refIdx = 0 }) {
15124
15150
  const stashMgr = new GitStashManager({ fs, dir, gitdir });
15125
15151
 
@@ -15223,21 +15249,22 @@ async function _stashPop({ fs, dir, gitdir, refIdx = 0 }) {
15223
15249
  // @ts-check
15224
15250
 
15225
15251
  /**
15226
- * stash api, supports {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear'} StashOp
15252
+ * stash api, supports {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear' | 'create'} StashOp
15227
15253
  * _note_,
15228
15254
  * - all stash operations are done on tracked files only with loose objects, no packed objects
15229
15255
  * - when op === 'push', both working directory and index (staged) changes will be stashed, tracked files only
15230
15256
  * - when op === 'push', message is optional, and only applicable when op === 'push'
15231
15257
  * - when op === 'apply | pop', the stashed changes will overwrite the working directory, no abort when conflicts
15258
+ * - when op === 'create', creates a stash commit without modifying working directory or refs, returns the commit hash
15232
15259
  *
15233
15260
  * @param {object} args
15234
15261
  * @param {FsClient} args.fs - [required] a file system client
15235
15262
  * @param {string} [args.dir] - [required] The [working tree](dir-vs-gitdir.md) directory path
15236
15263
  * @param {string} [args.gitdir=join(dir,'.git')] - [optional] The [git directory](dir-vs-gitdir.md) path
15237
- * @param {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear'} [args.op = 'push'] - [optional] name of stash operation, default to 'push'
15238
- * @param {string} [args.message = ''] - [optional] message to be used for the stash entry, only applicable when op === 'push'
15264
+ * @param {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear' | 'create'} [args.op = 'push'] - [optional] name of stash operation, default to 'push'
15265
+ * @param {string} [args.message = ''] - [optional] message to be used for the stash entry, only applicable when op === 'push' or 'create'
15239
15266
  * @param {number} [args.refIdx = 0] - [optional - Number] stash ref index of entry, only applicable when op === ['apply' | 'drop' | 'pop'], refIdx >= 0 and < num of stash pushed
15240
- * @returns {Promise<string | void>} Resolves successfully when stash operations are complete
15267
+ * @returns {Promise<string | void>} Resolves successfully when stash operations are complete. Returns commit hash for 'create' operation.
15241
15268
  *
15242
15269
  * @example
15243
15270
  * // stash changes in the working directory and index
@@ -15272,6 +15299,10 @@ async function _stashPop({ fs, dir, gitdir, refIdx = 0 }) {
15272
15299
  *
15273
15300
  * console.log(await git.status({ fs, dir, filepath: 'a.txt' })) // 'modified'
15274
15301
  * console.log(await git.status({ fs, dir, filepath: 'b.txt' })) // '*modified'
15302
+ *
15303
+ * // create a stash commit without modifying working directory
15304
+ * const stashCommitHash = await git.stash({ fs, dir, op: 'create', message: 'my stash' })
15305
+ * console.log(stashCommitHash) // returns the stash commit hash
15275
15306
  */
15276
15307
 
15277
15308
  async function stash({
@@ -15294,6 +15325,7 @@ async function stash({
15294
15325
  list: _stashList,
15295
15326
  clear: _stashClear,
15296
15327
  pop: _stashPop,
15328
+ create: _stashCreate,
15297
15329
  };
15298
15330
 
15299
15331
  const opsNeedRefIdx = ['apply', 'drop', 'pop'];
package/index.d.cts CHANGED
@@ -3033,21 +3033,22 @@ export function setConfig({ fs: _fs, dir, gitdir, path, value, append, }: {
3033
3033
  append?: boolean | undefined;
3034
3034
  }): Promise<void>;
3035
3035
  /**
3036
- * stash api, supports {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear'} StashOp
3036
+ * stash api, supports {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear' | 'create'} StashOp
3037
3037
  * _note_,
3038
3038
  * - all stash operations are done on tracked files only with loose objects, no packed objects
3039
3039
  * - when op === 'push', both working directory and index (staged) changes will be stashed, tracked files only
3040
3040
  * - when op === 'push', message is optional, and only applicable when op === 'push'
3041
3041
  * - when op === 'apply | pop', the stashed changes will overwrite the working directory, no abort when conflicts
3042
+ * - when op === 'create', creates a stash commit without modifying working directory or refs, returns the commit hash
3042
3043
  *
3043
3044
  * @param {object} args
3044
3045
  * @param {FsClient} args.fs - [required] a file system client
3045
3046
  * @param {string} [args.dir] - [required] The [working tree](dir-vs-gitdir.md) directory path
3046
3047
  * @param {string} [args.gitdir=join(dir,'.git')] - [optional] The [git directory](dir-vs-gitdir.md) path
3047
- * @param {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear'} [args.op = 'push'] - [optional] name of stash operation, default to 'push'
3048
- * @param {string} [args.message = ''] - [optional] message to be used for the stash entry, only applicable when op === 'push'
3048
+ * @param {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear' | 'create'} [args.op = 'push'] - [optional] name of stash operation, default to 'push'
3049
+ * @param {string} [args.message = ''] - [optional] message to be used for the stash entry, only applicable when op === 'push' or 'create'
3049
3050
  * @param {number} [args.refIdx = 0] - [optional - Number] stash ref index of entry, only applicable when op === ['apply' | 'drop' | 'pop'], refIdx >= 0 and < num of stash pushed
3050
- * @returns {Promise<string | void>} Resolves successfully when stash operations are complete
3051
+ * @returns {Promise<string | void>} Resolves successfully when stash operations are complete. Returns commit hash for 'create' operation.
3051
3052
  *
3052
3053
  * @example
3053
3054
  * // stash changes in the working directory and index
@@ -3082,12 +3083,16 @@ export function setConfig({ fs: _fs, dir, gitdir, path, value, append, }: {
3082
3083
  *
3083
3084
  * console.log(await git.status({ fs, dir, filepath: 'a.txt' })) // 'modified'
3084
3085
  * console.log(await git.status({ fs, dir, filepath: 'b.txt' })) // '*modified'
3086
+ *
3087
+ * // create a stash commit without modifying working directory
3088
+ * const stashCommitHash = await git.stash({ fs, dir, op: 'create', message: 'my stash' })
3089
+ * console.log(stashCommitHash) // returns the stash commit hash
3085
3090
  */
3086
3091
  export function stash({ fs, dir, gitdir, op, message, refIdx, }: {
3087
3092
  fs: FsClient;
3088
3093
  dir?: string | undefined;
3089
3094
  gitdir?: string | undefined;
3090
- op?: "pop" | "push" | "clear" | "drop" | "apply" | "list" | undefined;
3095
+ op?: "pop" | "push" | "clear" | "drop" | "apply" | "list" | "create" | undefined;
3091
3096
  message?: string | undefined;
3092
3097
  refIdx?: number | undefined;
3093
3098
  }): Promise<string | void>;
package/index.d.ts CHANGED
@@ -3032,21 +3032,22 @@ export function setConfig({ fs: _fs, dir, gitdir, path, value, append, }: {
3032
3032
  append?: boolean | undefined;
3033
3033
  }): Promise<void>;
3034
3034
  /**
3035
- * stash api, supports {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear'} StashOp
3035
+ * stash api, supports {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear' | 'create'} StashOp
3036
3036
  * _note_,
3037
3037
  * - all stash operations are done on tracked files only with loose objects, no packed objects
3038
3038
  * - when op === 'push', both working directory and index (staged) changes will be stashed, tracked files only
3039
3039
  * - when op === 'push', message is optional, and only applicable when op === 'push'
3040
3040
  * - when op === 'apply | pop', the stashed changes will overwrite the working directory, no abort when conflicts
3041
+ * - when op === 'create', creates a stash commit without modifying working directory or refs, returns the commit hash
3041
3042
  *
3042
3043
  * @param {object} args
3043
3044
  * @param {FsClient} args.fs - [required] a file system client
3044
3045
  * @param {string} [args.dir] - [required] The [working tree](dir-vs-gitdir.md) directory path
3045
3046
  * @param {string} [args.gitdir=join(dir,'.git')] - [optional] The [git directory](dir-vs-gitdir.md) path
3046
- * @param {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear'} [args.op = 'push'] - [optional] name of stash operation, default to 'push'
3047
- * @param {string} [args.message = ''] - [optional] message to be used for the stash entry, only applicable when op === 'push'
3047
+ * @param {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear' | 'create'} [args.op = 'push'] - [optional] name of stash operation, default to 'push'
3048
+ * @param {string} [args.message = ''] - [optional] message to be used for the stash entry, only applicable when op === 'push' or 'create'
3048
3049
  * @param {number} [args.refIdx = 0] - [optional - Number] stash ref index of entry, only applicable when op === ['apply' | 'drop' | 'pop'], refIdx >= 0 and < num of stash pushed
3049
- * @returns {Promise<string | void>} Resolves successfully when stash operations are complete
3050
+ * @returns {Promise<string | void>} Resolves successfully when stash operations are complete. Returns commit hash for 'create' operation.
3050
3051
  *
3051
3052
  * @example
3052
3053
  * // stash changes in the working directory and index
@@ -3081,12 +3082,16 @@ export function setConfig({ fs: _fs, dir, gitdir, path, value, append, }: {
3081
3082
  *
3082
3083
  * console.log(await git.status({ fs, dir, filepath: 'a.txt' })) // 'modified'
3083
3084
  * console.log(await git.status({ fs, dir, filepath: 'b.txt' })) // '*modified'
3085
+ *
3086
+ * // create a stash commit without modifying working directory
3087
+ * const stashCommitHash = await git.stash({ fs, dir, op: 'create', message: 'my stash' })
3088
+ * console.log(stashCommitHash) // returns the stash commit hash
3084
3089
  */
3085
3090
  export function stash({ fs, dir, gitdir, op, message, refIdx, }: {
3086
3091
  fs: FsClient;
3087
3092
  dir?: string | undefined;
3088
3093
  gitdir?: string | undefined;
3089
- op?: "pop" | "push" | "clear" | "drop" | "apply" | "list" | undefined;
3094
+ op?: "pop" | "push" | "clear" | "drop" | "apply" | "list" | "create" | undefined;
3090
3095
  message?: string | undefined;
3091
3096
  refIdx?: number | undefined;
3092
3097
  }): Promise<string | void>;
package/index.js CHANGED
@@ -8061,8 +8061,8 @@ function filterCapabilities(server, client) {
8061
8061
 
8062
8062
  const pkg = {
8063
8063
  name: 'isomorphic-git',
8064
- version: '1.33.3',
8065
- agent: 'git/isomorphic-git@1.33.3',
8064
+ version: '1.34.1',
8065
+ agent: 'git/isomorphic-git@1.34.1',
8066
8066
  };
8067
8067
 
8068
8068
  class FIFO {
@@ -15007,8 +15007,7 @@ class GitStashManager {
15007
15007
  return []
15008
15008
  }
15009
15009
 
15010
- const reflogBuffer = await this.fs.read(this.refLogsStashPath);
15011
- const reflogString = reflogBuffer.toString();
15010
+ const reflogString = await this.fs.read(this.refLogsStashPath, 'utf8');
15012
15011
 
15013
15012
  return GitRefStash.getStashReflogEntry(reflogString, parsed)
15014
15013
  }
@@ -15016,7 +15015,11 @@ class GitStashManager {
15016
15015
 
15017
15016
  // @ts-check
15018
15017
 
15019
- async function _stashPush({ fs, dir, gitdir, message = '' }) {
15018
+ /**
15019
+ * Common logic for creating a stash commit
15020
+ * @private
15021
+ */
15022
+ async function _createStashCommit({ fs, dir, gitdir, message = '' }) {
15020
15023
  const stashMgr = new GitStashManager({ fs, dir, gitdir });
15021
15024
 
15022
15025
  await stashMgr.getAuthor(); // ensure there is an author
@@ -15051,7 +15054,7 @@ async function _stashPush({ fs, dir, gitdir, message = '' }) {
15051
15054
  // create a commit from the index tree, which has one parent, the current branch HEAD
15052
15055
  const stashCommitOne = await stashMgr.writeStashCommit({
15053
15056
  message: `stash-Index: WIP on ${branch} - ${new Date().toISOString()}`,
15054
- tree: indexTree, // stashCommitTree
15057
+ tree: indexTree,
15055
15058
  parent: stashCommitParents,
15056
15059
  });
15057
15060
  stashCommitParents.push(stashCommitOne);
@@ -15092,6 +15095,17 @@ async function _stashPush({ fs, dir, gitdir, message = '' }) {
15092
15095
  parent: stashCommitParents,
15093
15096
  });
15094
15097
 
15098
+ return { stashCommit, stashMsg, branch, stashMgr }
15099
+ }
15100
+
15101
+ async function _stashPush({ fs, dir, gitdir, message = '' }) {
15102
+ const { stashCommit, stashMsg, branch, stashMgr } = await _createStashCommit({
15103
+ fs,
15104
+ dir,
15105
+ gitdir,
15106
+ message,
15107
+ });
15108
+
15095
15109
  // next, write this commit into .git/refs/stash:
15096
15110
  await stashMgr.writeStashRef(stashCommit);
15097
15111
 
@@ -15114,6 +15128,18 @@ async function _stashPush({ fs, dir, gitdir, message = '' }) {
15114
15128
  return stashCommit
15115
15129
  }
15116
15130
 
15131
+ async function _stashCreate({ fs, dir, gitdir, message = '' }) {
15132
+ const { stashCommit } = await _createStashCommit({
15133
+ fs,
15134
+ dir,
15135
+ gitdir,
15136
+ message,
15137
+ });
15138
+
15139
+ // Return the stash commit hash without modifying refs or working directory
15140
+ return stashCommit
15141
+ }
15142
+
15117
15143
  async function _stashApply({ fs, dir, gitdir, refIdx = 0 }) {
15118
15144
  const stashMgr = new GitStashManager({ fs, dir, gitdir });
15119
15145
 
@@ -15217,21 +15243,22 @@ async function _stashPop({ fs, dir, gitdir, refIdx = 0 }) {
15217
15243
  // @ts-check
15218
15244
 
15219
15245
  /**
15220
- * stash api, supports {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear'} StashOp
15246
+ * stash api, supports {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear' | 'create'} StashOp
15221
15247
  * _note_,
15222
15248
  * - all stash operations are done on tracked files only with loose objects, no packed objects
15223
15249
  * - when op === 'push', both working directory and index (staged) changes will be stashed, tracked files only
15224
15250
  * - when op === 'push', message is optional, and only applicable when op === 'push'
15225
15251
  * - when op === 'apply | pop', the stashed changes will overwrite the working directory, no abort when conflicts
15252
+ * - when op === 'create', creates a stash commit without modifying working directory or refs, returns the commit hash
15226
15253
  *
15227
15254
  * @param {object} args
15228
15255
  * @param {FsClient} args.fs - [required] a file system client
15229
15256
  * @param {string} [args.dir] - [required] The [working tree](dir-vs-gitdir.md) directory path
15230
15257
  * @param {string} [args.gitdir=join(dir,'.git')] - [optional] The [git directory](dir-vs-gitdir.md) path
15231
- * @param {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear'} [args.op = 'push'] - [optional] name of stash operation, default to 'push'
15232
- * @param {string} [args.message = ''] - [optional] message to be used for the stash entry, only applicable when op === 'push'
15258
+ * @param {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear' | 'create'} [args.op = 'push'] - [optional] name of stash operation, default to 'push'
15259
+ * @param {string} [args.message = ''] - [optional] message to be used for the stash entry, only applicable when op === 'push' or 'create'
15233
15260
  * @param {number} [args.refIdx = 0] - [optional - Number] stash ref index of entry, only applicable when op === ['apply' | 'drop' | 'pop'], refIdx >= 0 and < num of stash pushed
15234
- * @returns {Promise<string | void>} Resolves successfully when stash operations are complete
15261
+ * @returns {Promise<string | void>} Resolves successfully when stash operations are complete. Returns commit hash for 'create' operation.
15235
15262
  *
15236
15263
  * @example
15237
15264
  * // stash changes in the working directory and index
@@ -15266,6 +15293,10 @@ async function _stashPop({ fs, dir, gitdir, refIdx = 0 }) {
15266
15293
  *
15267
15294
  * console.log(await git.status({ fs, dir, filepath: 'a.txt' })) // 'modified'
15268
15295
  * console.log(await git.status({ fs, dir, filepath: 'b.txt' })) // '*modified'
15296
+ *
15297
+ * // create a stash commit without modifying working directory
15298
+ * const stashCommitHash = await git.stash({ fs, dir, op: 'create', message: 'my stash' })
15299
+ * console.log(stashCommitHash) // returns the stash commit hash
15269
15300
  */
15270
15301
 
15271
15302
  async function stash({
@@ -15288,6 +15319,7 @@ async function stash({
15288
15319
  list: _stashList,
15289
15320
  clear: _stashClear,
15290
15321
  pop: _stashPop,
15322
+ create: _stashCreate,
15291
15323
  };
15292
15324
 
15293
15325
  const opsNeedRefIdx = ['apply', 'drop', 'pop'];
@@ -3032,21 +3032,22 @@ export function setConfig({ fs: _fs, dir, gitdir, path, value, append, }: {
3032
3032
  append?: boolean | undefined;
3033
3033
  }): Promise<void>;
3034
3034
  /**
3035
- * stash api, supports {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear'} StashOp
3035
+ * stash api, supports {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear' | 'create'} StashOp
3036
3036
  * _note_,
3037
3037
  * - all stash operations are done on tracked files only with loose objects, no packed objects
3038
3038
  * - when op === 'push', both working directory and index (staged) changes will be stashed, tracked files only
3039
3039
  * - when op === 'push', message is optional, and only applicable when op === 'push'
3040
3040
  * - when op === 'apply | pop', the stashed changes will overwrite the working directory, no abort when conflicts
3041
+ * - when op === 'create', creates a stash commit without modifying working directory or refs, returns the commit hash
3041
3042
  *
3042
3043
  * @param {object} args
3043
3044
  * @param {FsClient} args.fs - [required] a file system client
3044
3045
  * @param {string} [args.dir] - [required] The [working tree](dir-vs-gitdir.md) directory path
3045
3046
  * @param {string} [args.gitdir=join(dir,'.git')] - [optional] The [git directory](dir-vs-gitdir.md) path
3046
- * @param {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear'} [args.op = 'push'] - [optional] name of stash operation, default to 'push'
3047
- * @param {string} [args.message = ''] - [optional] message to be used for the stash entry, only applicable when op === 'push'
3047
+ * @param {'push' | 'pop' | 'apply' | 'drop' | 'list' | 'clear' | 'create'} [args.op = 'push'] - [optional] name of stash operation, default to 'push'
3048
+ * @param {string} [args.message = ''] - [optional] message to be used for the stash entry, only applicable when op === 'push' or 'create'
3048
3049
  * @param {number} [args.refIdx = 0] - [optional - Number] stash ref index of entry, only applicable when op === ['apply' | 'drop' | 'pop'], refIdx >= 0 and < num of stash pushed
3049
- * @returns {Promise<string | void>} Resolves successfully when stash operations are complete
3050
+ * @returns {Promise<string | void>} Resolves successfully when stash operations are complete. Returns commit hash for 'create' operation.
3050
3051
  *
3051
3052
  * @example
3052
3053
  * // stash changes in the working directory and index
@@ -3081,12 +3082,16 @@ export function setConfig({ fs: _fs, dir, gitdir, path, value, append, }: {
3081
3082
  *
3082
3083
  * console.log(await git.status({ fs, dir, filepath: 'a.txt' })) // 'modified'
3083
3084
  * console.log(await git.status({ fs, dir, filepath: 'b.txt' })) // '*modified'
3085
+ *
3086
+ * // create a stash commit without modifying working directory
3087
+ * const stashCommitHash = await git.stash({ fs, dir, op: 'create', message: 'my stash' })
3088
+ * console.log(stashCommitHash) // returns the stash commit hash
3084
3089
  */
3085
3090
  export function stash({ fs, dir, gitdir, op, message, refIdx, }: {
3086
3091
  fs: FsClient;
3087
3092
  dir?: string | undefined;
3088
3093
  gitdir?: string | undefined;
3089
- op?: "pop" | "push" | "clear" | "drop" | "apply" | "list" | undefined;
3094
+ op?: "pop" | "push" | "clear" | "drop" | "apply" | "list" | "create" | undefined;
3090
3095
  message?: string | undefined;
3091
3096
  refIdx?: number | undefined;
3092
3097
  }): Promise<string | void>;