isomorphic-git 1.10.5 → 1.12.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
@@ -27,7 +27,7 @@ The following environments are tested in CI and will continue to be supported un
27
27
  <td align="center"><img src="https://raw.githubusercontent.com/alrra/browser-logos/bc47e4601d2c1fd46a7912f9aed5cdda4afdb301/src/edge/edge.svg?sanitize=true" alt="" width="64" height="64"><br> Edge 79</td>
28
28
  <td align="center"><img src="https://raw.githubusercontent.com/alrra/browser-logos/bc47e4601d2c1fd46a7912f9aed5cdda4afdb301/src/firefox/firefox.svg?sanitize=true" alt="" width="64" height="64"><br> Firefox 72</td>
29
29
  <td align="center"><img src="https://raw.githubusercontent.com/alrra/browser-logos/bc47e4601d2c1fd46a7912f9aed5cdda4afdb301/src/safari/safari_64x64.png" alt="" width="64" height="64"><br> Safari 13</td>
30
- <td align="center"><img src="https://upload.wikimedia.org/wikipedia/commons/8/82/Android_logo_2019.svg" alt="" width="64" height="64"><br> Android 10</td>
30
+ <td align="center"><img src="https://upload.wikimedia.org/wikipedia/commons/6/64/Android_logo_2019_%28stacked%29.svg" alt="" width="64" height="64"><br> Android 10</td>
31
31
  <td align="center"><img src="https://upload.wikimedia.org/wikipedia/commons/d/d6/IOS_13_logo.svg" alt="" width="64" height="64"><br> iOS 13</td>
32
32
  </tr>
33
33
  </table>
@@ -339,6 +339,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
339
339
  <td align="center"><a href="https://github.com/strangedev"><img src="https://avatars.githubusercontent.com/u/3045979?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Noah Hummel</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=strangedev" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=strangedev" title="Tests">⚠️</a></td>
340
340
  <td align="center"><a href="https://github.com/mtlewis"><img src="https://avatars.githubusercontent.com/u/542836?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Mike Lewis</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=mtlewis" title="Documentation">📖</a></td>
341
341
  <td align="center"><a href="https://twitter.com/SamVerschueren"><img src="https://avatars.githubusercontent.com/u/1913805?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Sam Verschueren</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=SamVerschueren" title="Code">💻</a></td>
342
+ <td align="center"><a href="http://vitorluizc.github.io/"><img src="https://avatars.githubusercontent.com/u/9027363?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Vitor Luiz Cavalcanti</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=VitorLuizC" title="Documentation">📖</a></td>
342
343
  </tr>
343
344
  </table>
344
345
 
@@ -1,8 +1,9 @@
1
1
  [
2
2
  "HeadlessChrome 0.0.0 (Linux 0.0.0)",
3
- "Firefox 96.0.0 (Ubuntu 0.0.0)",
4
- "Chrome 79.0.3945 (Windows 10 0.0.0)",
3
+ "X Firefox 96.0.0 (Ubuntu 0.0.0)",
5
4
  "Chrome Mobile 96.0.4664 (Android 0.0.0)",
5
+ "Chrome 79.0.3945 (Windows 10 0.0.0)",
6
6
  "Safari 13.1.0 (Mac OS X 10.15.4)",
7
- "Mobile Safari 13.0.0 (iOS 13.0.0)"
7
+ "Mobile Safari 13.0.0 (iOS 13.0.0)",
8
+ "Firefox 96.0.0 (Ubuntu 0.0.0)"
8
9
  ]
@@ -24,6 +24,7 @@ var get = _interopDefault(require('simple-get'));
24
24
  * @property {string} url - The URL to request
25
25
  * @property {string} [method='GET'] - The HTTP method to use
26
26
  * @property {Object<string, string>} [headers={}] - Headers to include in the HTTP request
27
+ * @property {Object} [agent] - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
27
28
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
28
29
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
29
30
  * @property {object} [signal] - Reserved for future use (canceling a request)
@@ -192,6 +193,7 @@ async function request({
192
193
  url,
193
194
  method = 'GET',
194
195
  headers = {},
196
+ agent,
195
197
  body,
196
198
  }) {
197
199
  // If we can, we should send it as a single buffer so it sets a Content-Length header.
@@ -206,6 +208,7 @@ async function request({
206
208
  url,
207
209
  method,
208
210
  headers,
211
+ agent,
209
212
  body,
210
213
  },
211
214
  (err, res) => {
@@ -20,6 +20,10 @@ export type GitHttpRequest = {
20
20
  headers?: {
21
21
  [x: string]: string;
22
22
  };
23
+ /**
24
+ * - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
25
+ */
26
+ agent?: any;
23
27
  /**
24
28
  * - An async iterator of Uint8Arrays that make up the body of POST requests
25
29
  */
@@ -74,4 +78,4 @@ declare namespace index {
74
78
  * @param {GitHttpRequest} request
75
79
  * @returns {Promise<GitHttpResponse>}
76
80
  */
77
- export function request({ onProgress, url, method, headers, body, }: GitHttpRequest): Promise<GitHttpResponse>;
81
+ export function request({ onProgress, url, method, headers, agent, body, }: GitHttpRequest): Promise<GitHttpResponse>;
@@ -18,6 +18,7 @@ import get from 'simple-get';
18
18
  * @property {string} url - The URL to request
19
19
  * @property {string} [method='GET'] - The HTTP method to use
20
20
  * @property {Object<string, string>} [headers={}] - Headers to include in the HTTP request
21
+ * @property {Object} [agent] - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
21
22
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
22
23
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
23
24
  * @property {object} [signal] - Reserved for future use (canceling a request)
@@ -186,6 +187,7 @@ async function request({
186
187
  url,
187
188
  method = 'GET',
188
189
  headers = {},
190
+ agent,
189
191
  body,
190
192
  }) {
191
193
  // If we can, we should send it as a single buffer so it sets a Content-Length header.
@@ -200,6 +202,7 @@ async function request({
200
202
  url,
201
203
  method,
202
204
  headers,
205
+ agent,
203
206
  body,
204
207
  },
205
208
  (err, res) => {
@@ -20,6 +20,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
20
20
  * @property {string} url - The URL to request
21
21
  * @property {string} [method='GET'] - The HTTP method to use
22
22
  * @property {Object<string, string>} [headers={}] - Headers to include in the HTTP request
23
+ * @property {Object} [agent] - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
23
24
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
24
25
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
25
26
  * @property {object} [signal] - Reserved for future use (canceling a request)
@@ -20,6 +20,10 @@ export type GitHttpRequest = {
20
20
  headers?: {
21
21
  [x: string]: string;
22
22
  };
23
+ /**
24
+ * - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
25
+ */
26
+ agent?: any;
23
27
  /**
24
28
  * - An async iterator of Uint8Arrays that make up the body of POST requests
25
29
  */
package/http/web/index.js CHANGED
@@ -16,6 +16,7 @@
16
16
  * @property {string} url - The URL to request
17
17
  * @property {string} [method='GET'] - The HTTP method to use
18
18
  * @property {Object<string, string>} [headers={}] - Headers to include in the HTTP request
19
+ * @property {Object} [agent] - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
19
20
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
20
21
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
21
22
  * @property {object} [signal] - Reserved for future use (canceling a request)
@@ -22,6 +22,7 @@
22
22
  * @property {string} url - The URL to request
23
23
  * @property {string} [method='GET'] - The HTTP method to use
24
24
  * @property {Object<string, string>} [headers={}] - Headers to include in the HTTP request
25
+ * @property {Object} [agent] - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
25
26
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
26
27
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
27
28
  * @property {object} [signal] - Reserved for future use (canceling a request)
package/index.cjs CHANGED
@@ -31,6 +31,7 @@ var diff3Merge = _interopDefault(require('diff3'));
31
31
  * @property {string} url - The URL to request
32
32
  * @property {string} [method='GET'] - The HTTP method to use
33
33
  * @property {Object<string, string>} [headers={}] - Headers to include in the HTTP request
34
+ * @property {Object} [agent] - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
34
35
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
35
36
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
36
37
  * @property {object} [signal] - Reserved for future use (canceling a request)
@@ -3271,7 +3272,7 @@ class UnknownTransportError extends BaseError {
3271
3272
  /**
3272
3273
  * @param {string} url
3273
3274
  * @param {string} transport
3274
- * @param {string} suggestion
3275
+ * @param {string} [suggestion]
3275
3276
  */
3276
3277
  constructor(url, transport, suggestion) {
3277
3278
  super(
@@ -5551,6 +5552,7 @@ const worthWalking = (filepath, root) => {
5551
5552
  * @param {boolean} [args.noUpdateHead]
5552
5553
  * @param {boolean} [args.dryRun]
5553
5554
  * @param {boolean} [args.force]
5555
+ * @param {boolean} [args.track]
5554
5556
  *
5555
5557
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
5556
5558
  *
@@ -5568,6 +5570,7 @@ async function _checkout({
5568
5570
  noUpdateHead,
5569
5571
  dryRun,
5570
5572
  force,
5573
+ track = true,
5571
5574
  }) {
5572
5575
  // Get tree oid
5573
5576
  let oid;
@@ -5585,11 +5588,13 @@ async function _checkout({
5585
5588
  gitdir,
5586
5589
  ref: remoteRef,
5587
5590
  });
5588
- // Set up remote tracking branch
5589
- const config = await GitConfigManager.get({ fs, gitdir });
5590
- await config.set(`branch.${ref}.remote`, remote);
5591
- await config.set(`branch.${ref}.merge`, `refs/heads/${ref}`);
5592
- await GitConfigManager.save({ fs, gitdir, config });
5591
+ if (track) {
5592
+ // Set up remote tracking branch
5593
+ const config = await GitConfigManager.get({ fs, gitdir });
5594
+ await config.set(`branch.${ref}.remote`, remote);
5595
+ await config.set(`branch.${ref}.merge`, `refs/heads/${ref}`);
5596
+ await GitConfigManager.save({ fs, gitdir, config });
5597
+ }
5593
5598
  // Create a new branch that points at that same commit
5594
5599
  await GitRefManager.writeRef({
5595
5600
  fs,
@@ -6114,6 +6119,7 @@ async function analyze({
6114
6119
  * @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.
6115
6120
  * @param {boolean} [args.dryRun = false] - If true, simulates a checkout so you can test whether it would succeed.
6116
6121
  * @param {boolean} [args.force = false] - If true, conflicts will be ignored and files will be overwritten regardless of local changes.
6122
+ * @param {boolean} [args.track = true] - If false, will not set the remote branch tracking information. Defaults to true.
6117
6123
  * @param {object} [args.cache] - a [cache](cache.md) object
6118
6124
  *
6119
6125
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
@@ -6161,6 +6167,7 @@ async function checkout({
6161
6167
  noUpdateHead = _ref === undefined,
6162
6168
  dryRun = false,
6163
6169
  force = false,
6170
+ track = true,
6164
6171
  cache = {},
6165
6172
  }) {
6166
6173
  try {
@@ -6182,6 +6189,7 @@ async function checkout({
6182
6189
  noUpdateHead,
6183
6190
  dryRun,
6184
6191
  force,
6192
+ track,
6185
6193
  })
6186
6194
  } catch (err) {
6187
6195
  err.caller = 'git.checkout';
@@ -6865,8 +6873,8 @@ function filterCapabilities(server, client) {
6865
6873
 
6866
6874
  const pkg = {
6867
6875
  name: 'isomorphic-git',
6868
- version: '1.10.5',
6869
- agent: 'git/isomorphic-git@1.10.5',
6876
+ version: '1.12.0',
6877
+ agent: 'git/isomorphic-git@1.12.0',
6870
6878
  };
6871
6879
 
6872
6880
  class FIFO {
@@ -12742,32 +12750,47 @@ async function resetIndex({
12742
12750
  dir,
12743
12751
  gitdir = join(dir, '.git'),
12744
12752
  filepath,
12745
- ref = 'HEAD',
12753
+ ref,
12746
12754
  cache = {},
12747
12755
  }) {
12748
12756
  try {
12749
12757
  assertParameter('fs', _fs);
12750
12758
  assertParameter('gitdir', gitdir);
12751
12759
  assertParameter('filepath', filepath);
12752
- assertParameter('ref', ref);
12753
12760
 
12754
12761
  const fs = new FileSystem(_fs);
12755
- // Resolve commit
12756
- let oid = await GitRefManager.resolve({ fs, gitdir, ref });
12762
+
12763
+ let oid;
12757
12764
  let workdirOid;
12765
+
12758
12766
  try {
12759
- // Resolve blob
12760
- oid = await resolveFilepath({
12761
- fs,
12762
- cache,
12763
- gitdir,
12764
- oid,
12765
- filepath,
12766
- });
12767
+ // Resolve commit
12768
+ oid = await GitRefManager.resolve({ fs, gitdir, ref: ref || 'HEAD' });
12767
12769
  } catch (e) {
12768
- // This means we're resetting the file to a "deleted" state
12769
- oid = null;
12770
+ if (ref) {
12771
+ // Only throw the error if a ref is explicitly provided
12772
+ throw e
12773
+ }
12770
12774
  }
12775
+
12776
+ // Not having an oid at this point means `resetIndex()` was called without explicit `ref` on a new git
12777
+ // repository. If that happens, we can skip resolving the file path.
12778
+ if (oid) {
12779
+ try {
12780
+ // Resolve blob
12781
+ oid = await resolveFilepath({
12782
+ fs,
12783
+ cache,
12784
+ gitdir,
12785
+ oid,
12786
+ filepath,
12787
+ });
12788
+ } catch (e) {
12789
+ // This means we're resetting the file to a "deleted" state
12790
+ oid = null;
12791
+ }
12792
+ }
12793
+
12771
12794
  // For files that aren't in the workdir use zeros
12772
12795
  let stats = {
12773
12796
  ctime: new Date(0),
package/index.d.ts CHANGED
@@ -288,6 +288,10 @@ export type GitHttpRequest = {
288
288
  headers?: {
289
289
  [x: string]: string;
290
290
  };
291
+ /**
292
+ * - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
293
+ */
294
+ agent?: any;
291
295
  /**
292
296
  * - An async iterator of Uint8Arrays that make up the body of POST requests
293
297
  */
@@ -944,6 +948,7 @@ export function branch({ fs, dir, gitdir, ref, checkout, }: {
944
948
  * @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.
945
949
  * @param {boolean} [args.dryRun = false] - If true, simulates a checkout so you can test whether it would succeed.
946
950
  * @param {boolean} [args.force = false] - If true, conflicts will be ignored and files will be overwritten regardless of local changes.
951
+ * @param {boolean} [args.track = true] - If false, will not set the remote branch tracking information. Defaults to true.
947
952
  * @param {object} [args.cache] - a [cache](cache.md) object
948
953
  *
949
954
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
@@ -979,7 +984,7 @@ export function branch({ fs, dir, gitdir, ref, checkout, }: {
979
984
  * })
980
985
  * console.log('done')
981
986
  */
982
- export function checkout({ fs, onProgress, dir, gitdir, remote, ref: _ref, filepaths, noCheckout, noUpdateHead, dryRun, force, cache, }: {
987
+ export function checkout({ fs, onProgress, dir, gitdir, remote, ref: _ref, filepaths, noCheckout, noUpdateHead, dryRun, force, track, cache, }: {
983
988
  fs: CallbackFsClient | PromiseFsClient;
984
989
  onProgress?: ProgressCallback;
985
990
  dir: string;
@@ -991,6 +996,7 @@ export function checkout({ fs, onProgress, dir, gitdir, remote, ref: _ref, filep
991
996
  noUpdateHead?: boolean;
992
997
  dryRun?: boolean;
993
998
  force?: boolean;
999
+ track?: boolean;
994
1000
  cache?: any;
995
1001
  }): Promise<void>;
996
1002
  /**
@@ -3946,15 +3952,15 @@ declare class UnknownTransportError extends BaseError {
3946
3952
  /**
3947
3953
  * @param {string} url
3948
3954
  * @param {string} transport
3949
- * @param {string} suggestion
3955
+ * @param {string} [suggestion]
3950
3956
  */
3951
- constructor(url: string, transport: string, suggestion: string);
3957
+ constructor(url: string, transport: string, suggestion?: string | undefined);
3952
3958
  code: "UnknownTransportError";
3953
3959
  name: "UnknownTransportError";
3954
3960
  data: {
3955
3961
  url: string;
3956
3962
  transport: string;
3957
- suggestion: string;
3963
+ suggestion: string | undefined;
3958
3964
  };
3959
3965
  }
3960
3966
  declare namespace UnknownTransportError {
@@ -4016,6 +4022,7 @@ declare namespace UserCanceledError {
4016
4022
  * @property {string} url - The URL to request
4017
4023
  * @property {string} [method='GET'] - The HTTP method to use
4018
4024
  * @property {Object<string, string>} [headers={}] - Headers to include in the HTTP request
4025
+ * @property {Object} [agent] - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
4019
4026
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
4020
4027
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
4021
4028
  * @property {object} [signal] - Reserved for future use (canceling a request)
package/index.js CHANGED
@@ -25,6 +25,7 @@ import diff3Merge from 'diff3';
25
25
  * @property {string} url - The URL to request
26
26
  * @property {string} [method='GET'] - The HTTP method to use
27
27
  * @property {Object<string, string>} [headers={}] - Headers to include in the HTTP request
28
+ * @property {Object} [agent] - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
28
29
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
29
30
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
30
31
  * @property {object} [signal] - Reserved for future use (canceling a request)
@@ -3265,7 +3266,7 @@ class UnknownTransportError extends BaseError {
3265
3266
  /**
3266
3267
  * @param {string} url
3267
3268
  * @param {string} transport
3268
- * @param {string} suggestion
3269
+ * @param {string} [suggestion]
3269
3270
  */
3270
3271
  constructor(url, transport, suggestion) {
3271
3272
  super(
@@ -5545,6 +5546,7 @@ const worthWalking = (filepath, root) => {
5545
5546
  * @param {boolean} [args.noUpdateHead]
5546
5547
  * @param {boolean} [args.dryRun]
5547
5548
  * @param {boolean} [args.force]
5549
+ * @param {boolean} [args.track]
5548
5550
  *
5549
5551
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
5550
5552
  *
@@ -5562,6 +5564,7 @@ async function _checkout({
5562
5564
  noUpdateHead,
5563
5565
  dryRun,
5564
5566
  force,
5567
+ track = true,
5565
5568
  }) {
5566
5569
  // Get tree oid
5567
5570
  let oid;
@@ -5579,11 +5582,13 @@ async function _checkout({
5579
5582
  gitdir,
5580
5583
  ref: remoteRef,
5581
5584
  });
5582
- // Set up remote tracking branch
5583
- const config = await GitConfigManager.get({ fs, gitdir });
5584
- await config.set(`branch.${ref}.remote`, remote);
5585
- await config.set(`branch.${ref}.merge`, `refs/heads/${ref}`);
5586
- await GitConfigManager.save({ fs, gitdir, config });
5585
+ if (track) {
5586
+ // Set up remote tracking branch
5587
+ const config = await GitConfigManager.get({ fs, gitdir });
5588
+ await config.set(`branch.${ref}.remote`, remote);
5589
+ await config.set(`branch.${ref}.merge`, `refs/heads/${ref}`);
5590
+ await GitConfigManager.save({ fs, gitdir, config });
5591
+ }
5587
5592
  // Create a new branch that points at that same commit
5588
5593
  await GitRefManager.writeRef({
5589
5594
  fs,
@@ -6108,6 +6113,7 @@ async function analyze({
6108
6113
  * @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.
6109
6114
  * @param {boolean} [args.dryRun = false] - If true, simulates a checkout so you can test whether it would succeed.
6110
6115
  * @param {boolean} [args.force = false] - If true, conflicts will be ignored and files will be overwritten regardless of local changes.
6116
+ * @param {boolean} [args.track = true] - If false, will not set the remote branch tracking information. Defaults to true.
6111
6117
  * @param {object} [args.cache] - a [cache](cache.md) object
6112
6118
  *
6113
6119
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
@@ -6155,6 +6161,7 @@ async function checkout({
6155
6161
  noUpdateHead = _ref === undefined,
6156
6162
  dryRun = false,
6157
6163
  force = false,
6164
+ track = true,
6158
6165
  cache = {},
6159
6166
  }) {
6160
6167
  try {
@@ -6176,6 +6183,7 @@ async function checkout({
6176
6183
  noUpdateHead,
6177
6184
  dryRun,
6178
6185
  force,
6186
+ track,
6179
6187
  })
6180
6188
  } catch (err) {
6181
6189
  err.caller = 'git.checkout';
@@ -6859,8 +6867,8 @@ function filterCapabilities(server, client) {
6859
6867
 
6860
6868
  const pkg = {
6861
6869
  name: 'isomorphic-git',
6862
- version: '1.10.5',
6863
- agent: 'git/isomorphic-git@1.10.5',
6870
+ version: '1.12.0',
6871
+ agent: 'git/isomorphic-git@1.12.0',
6864
6872
  };
6865
6873
 
6866
6874
  class FIFO {
@@ -12736,32 +12744,47 @@ async function resetIndex({
12736
12744
  dir,
12737
12745
  gitdir = join(dir, '.git'),
12738
12746
  filepath,
12739
- ref = 'HEAD',
12747
+ ref,
12740
12748
  cache = {},
12741
12749
  }) {
12742
12750
  try {
12743
12751
  assertParameter('fs', _fs);
12744
12752
  assertParameter('gitdir', gitdir);
12745
12753
  assertParameter('filepath', filepath);
12746
- assertParameter('ref', ref);
12747
12754
 
12748
12755
  const fs = new FileSystem(_fs);
12749
- // Resolve commit
12750
- let oid = await GitRefManager.resolve({ fs, gitdir, ref });
12756
+
12757
+ let oid;
12751
12758
  let workdirOid;
12759
+
12752
12760
  try {
12753
- // Resolve blob
12754
- oid = await resolveFilepath({
12755
- fs,
12756
- cache,
12757
- gitdir,
12758
- oid,
12759
- filepath,
12760
- });
12761
+ // Resolve commit
12762
+ oid = await GitRefManager.resolve({ fs, gitdir, ref: ref || 'HEAD' });
12761
12763
  } catch (e) {
12762
- // This means we're resetting the file to a "deleted" state
12763
- oid = null;
12764
+ if (ref) {
12765
+ // Only throw the error if a ref is explicitly provided
12766
+ throw e
12767
+ }
12764
12768
  }
12769
+
12770
+ // Not having an oid at this point means `resetIndex()` was called without explicit `ref` on a new git
12771
+ // repository. If that happens, we can skip resolving the file path.
12772
+ if (oid) {
12773
+ try {
12774
+ // Resolve blob
12775
+ oid = await resolveFilepath({
12776
+ fs,
12777
+ cache,
12778
+ gitdir,
12779
+ oid,
12780
+ filepath,
12781
+ });
12782
+ } catch (e) {
12783
+ // This means we're resetting the file to a "deleted" state
12784
+ oid = null;
12785
+ }
12786
+ }
12787
+
12765
12788
  // For files that aren't in the workdir use zeros
12766
12789
  let stats = {
12767
12790
  ctime: new Date(0),
@@ -288,6 +288,10 @@ export type GitHttpRequest = {
288
288
  headers?: {
289
289
  [x: string]: string;
290
290
  };
291
+ /**
292
+ * - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
293
+ */
294
+ agent?: any;
291
295
  /**
292
296
  * - An async iterator of Uint8Arrays that make up the body of POST requests
293
297
  */
@@ -944,6 +948,7 @@ export function branch({ fs, dir, gitdir, ref, checkout, }: {
944
948
  * @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.
945
949
  * @param {boolean} [args.dryRun = false] - If true, simulates a checkout so you can test whether it would succeed.
946
950
  * @param {boolean} [args.force = false] - If true, conflicts will be ignored and files will be overwritten regardless of local changes.
951
+ * @param {boolean} [args.track = true] - If false, will not set the remote branch tracking information. Defaults to true.
947
952
  * @param {object} [args.cache] - a [cache](cache.md) object
948
953
  *
949
954
  * @returns {Promise<void>} Resolves successfully when filesystem operations are complete
@@ -979,7 +984,7 @@ export function branch({ fs, dir, gitdir, ref, checkout, }: {
979
984
  * })
980
985
  * console.log('done')
981
986
  */
982
- export function checkout({ fs, onProgress, dir, gitdir, remote, ref: _ref, filepaths, noCheckout, noUpdateHead, dryRun, force, cache, }: {
987
+ export function checkout({ fs, onProgress, dir, gitdir, remote, ref: _ref, filepaths, noCheckout, noUpdateHead, dryRun, force, track, cache, }: {
983
988
  fs: CallbackFsClient | PromiseFsClient;
984
989
  onProgress?: ProgressCallback;
985
990
  dir: string;
@@ -991,6 +996,7 @@ export function checkout({ fs, onProgress, dir, gitdir, remote, ref: _ref, filep
991
996
  noUpdateHead?: boolean;
992
997
  dryRun?: boolean;
993
998
  force?: boolean;
999
+ track?: boolean;
994
1000
  cache?: any;
995
1001
  }): Promise<void>;
996
1002
  /**
@@ -3946,15 +3952,15 @@ declare class UnknownTransportError extends BaseError {
3946
3952
  /**
3947
3953
  * @param {string} url
3948
3954
  * @param {string} transport
3949
- * @param {string} suggestion
3955
+ * @param {string} [suggestion]
3950
3956
  */
3951
- constructor(url: string, transport: string, suggestion: string);
3957
+ constructor(url: string, transport: string, suggestion?: string | undefined);
3952
3958
  code: "UnknownTransportError";
3953
3959
  name: "UnknownTransportError";
3954
3960
  data: {
3955
3961
  url: string;
3956
3962
  transport: string;
3957
- suggestion: string;
3963
+ suggestion: string | undefined;
3958
3964
  };
3959
3965
  }
3960
3966
  declare namespace UnknownTransportError {
@@ -4016,6 +4022,7 @@ declare namespace UserCanceledError {
4016
4022
  * @property {string} url - The URL to request
4017
4023
  * @property {string} [method='GET'] - The HTTP method to use
4018
4024
  * @property {Object<string, string>} [headers={}] - Headers to include in the HTTP request
4025
+ * @property {Object} [agent] - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
4019
4026
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
4020
4027
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
4021
4028
  * @property {object} [signal] - Reserved for future use (canceling a request)