isomorphic-git 1.11.2 → 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.
@@ -1,9 +1,9 @@
1
1
  [
2
2
  "HeadlessChrome 0.0.0 (Linux 0.0.0)",
3
- "Firefox 96.0.0 (Ubuntu 0.0.0)",
4
- "Safari 13.1.0 (Mac OS X 10.15.4)",
3
+ "X Firefox 96.0.0 (Ubuntu 0.0.0)",
4
+ "Chrome Mobile 96.0.4664 (Android 0.0.0)",
5
5
  "Chrome 79.0.3945 (Windows 10 0.0.0)",
6
+ "Safari 13.1.0 (Mac OS X 10.15.4)",
6
7
  "Mobile Safari 13.0.0 (iOS 13.0.0)",
7
- "X Chrome Mobile 96.0.4664 (Android 0.0.0)",
8
- "Chrome Mobile 96.0.4664 (Android 0.0.0)"
8
+ "Firefox 96.0.0 (Ubuntu 0.0.0)"
9
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)
@@ -6872,8 +6873,8 @@ function filterCapabilities(server, client) {
6872
6873
 
6873
6874
  const pkg = {
6874
6875
  name: 'isomorphic-git',
6875
- version: '1.11.2',
6876
- agent: 'git/isomorphic-git@1.11.2',
6876
+ version: '1.12.0',
6877
+ agent: 'git/isomorphic-git@1.12.0',
6877
6878
  };
6878
6879
 
6879
6880
  class FIFO {
@@ -12749,32 +12750,47 @@ async function resetIndex({
12749
12750
  dir,
12750
12751
  gitdir = join(dir, '.git'),
12751
12752
  filepath,
12752
- ref = 'HEAD',
12753
+ ref,
12753
12754
  cache = {},
12754
12755
  }) {
12755
12756
  try {
12756
12757
  assertParameter('fs', _fs);
12757
12758
  assertParameter('gitdir', gitdir);
12758
12759
  assertParameter('filepath', filepath);
12759
- assertParameter('ref', ref);
12760
12760
 
12761
12761
  const fs = new FileSystem(_fs);
12762
- // Resolve commit
12763
- let oid = await GitRefManager.resolve({ fs, gitdir, ref });
12762
+
12763
+ let oid;
12764
12764
  let workdirOid;
12765
+
12765
12766
  try {
12766
- // Resolve blob
12767
- oid = await resolveFilepath({
12768
- fs,
12769
- cache,
12770
- gitdir,
12771
- oid,
12772
- filepath,
12773
- });
12767
+ // Resolve commit
12768
+ oid = await GitRefManager.resolve({ fs, gitdir, ref: ref || 'HEAD' });
12774
12769
  } catch (e) {
12775
- // This means we're resetting the file to a "deleted" state
12776
- oid = null;
12770
+ if (ref) {
12771
+ // Only throw the error if a ref is explicitly provided
12772
+ throw e
12773
+ }
12777
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
+
12778
12794
  // For files that aren't in the workdir use zeros
12779
12795
  let stats = {
12780
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
  */
@@ -4018,6 +4022,7 @@ declare namespace UserCanceledError {
4018
4022
  * @property {string} url - The URL to request
4019
4023
  * @property {string} [method='GET'] - The HTTP method to use
4020
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)
4021
4026
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
4022
4027
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
4023
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)
@@ -6866,8 +6867,8 @@ function filterCapabilities(server, client) {
6866
6867
 
6867
6868
  const pkg = {
6868
6869
  name: 'isomorphic-git',
6869
- version: '1.11.2',
6870
- agent: 'git/isomorphic-git@1.11.2',
6870
+ version: '1.12.0',
6871
+ agent: 'git/isomorphic-git@1.12.0',
6871
6872
  };
6872
6873
 
6873
6874
  class FIFO {
@@ -12743,32 +12744,47 @@ async function resetIndex({
12743
12744
  dir,
12744
12745
  gitdir = join(dir, '.git'),
12745
12746
  filepath,
12746
- ref = 'HEAD',
12747
+ ref,
12747
12748
  cache = {},
12748
12749
  }) {
12749
12750
  try {
12750
12751
  assertParameter('fs', _fs);
12751
12752
  assertParameter('gitdir', gitdir);
12752
12753
  assertParameter('filepath', filepath);
12753
- assertParameter('ref', ref);
12754
12754
 
12755
12755
  const fs = new FileSystem(_fs);
12756
- // Resolve commit
12757
- let oid = await GitRefManager.resolve({ fs, gitdir, ref });
12756
+
12757
+ let oid;
12758
12758
  let workdirOid;
12759
+
12759
12760
  try {
12760
- // Resolve blob
12761
- oid = await resolveFilepath({
12762
- fs,
12763
- cache,
12764
- gitdir,
12765
- oid,
12766
- filepath,
12767
- });
12761
+ // Resolve commit
12762
+ oid = await GitRefManager.resolve({ fs, gitdir, ref: ref || 'HEAD' });
12768
12763
  } catch (e) {
12769
- // This means we're resetting the file to a "deleted" state
12770
- oid = null;
12764
+ if (ref) {
12765
+ // Only throw the error if a ref is explicitly provided
12766
+ throw e
12767
+ }
12771
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
+
12772
12788
  // For files that aren't in the workdir use zeros
12773
12789
  let stats = {
12774
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
  */
@@ -4018,6 +4022,7 @@ declare namespace UserCanceledError {
4018
4022
  * @property {string} url - The URL to request
4019
4023
  * @property {string} [method='GET'] - The HTTP method to use
4020
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)
4021
4026
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
4022
4027
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
4023
4028
  * @property {object} [signal] - Reserved for future use (canceling a request)