isomorphic-git 1.11.2 → 1.13.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,8 @@
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
+ "Firefox 97.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
- "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)"
6
+ "Safari 13.1.0 (Mac OS X 10.15.4)",
7
+ "Mobile Safari 13.0.0 (iOS 13.0.0)"
9
8
  ]
@@ -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.13.0',
6877
+ agent: 'git/isomorphic-git@1.13.0',
6877
6878
  };
6878
6879
 
6879
6880
  class FIFO {
@@ -8643,6 +8644,7 @@ async function mergeBlobs({
8643
8644
  * @param {string} args.gitdir
8644
8645
  * @param {string} [args.ours]
8645
8646
  * @param {string} args.theirs
8647
+ * @param {boolean} args.fastForward
8646
8648
  * @param {boolean} args.fastForwardOnly
8647
8649
  * @param {boolean} args.dryRun
8648
8650
  * @param {boolean} args.noUpdateBranch
@@ -8669,6 +8671,7 @@ async function _merge({
8669
8671
  gitdir,
8670
8672
  ours,
8671
8673
  theirs,
8674
+ fastForward = true,
8672
8675
  fastForwardOnly = false,
8673
8676
  dryRun = false,
8674
8677
  noUpdateBranch = false,
@@ -8719,7 +8722,7 @@ async function _merge({
8719
8722
  alreadyMerged: true,
8720
8723
  }
8721
8724
  }
8722
- if (baseOid === ourOid) {
8725
+ if (fastForward && baseOid === ourOid) {
8723
8726
  if (!dryRun && !noUpdateBranch) {
8724
8727
  await GitRefManager.writeRef({ fs, gitdir, ref: ours, value: theirOid });
8725
8728
  }
@@ -8793,6 +8796,7 @@ async function _merge({
8793
8796
  * @param {string} [args.remoteRef]
8794
8797
  * @param {string} [args.corsProxy]
8795
8798
  * @param {boolean} args.singleBranch
8799
+ * @param {boolean} args.fastForward
8796
8800
  * @param {boolean} args.fastForwardOnly
8797
8801
  * @param {Object<string, string>} [args.headers]
8798
8802
  * @param {Object} args.author
@@ -8825,6 +8829,7 @@ async function _pull({
8825
8829
  url,
8826
8830
  remote,
8827
8831
  remoteRef,
8832
+ fastForward,
8828
8833
  fastForwardOnly,
8829
8834
  corsProxy,
8830
8835
  singleBranch,
@@ -8869,6 +8874,7 @@ async function _pull({
8869
8874
  gitdir,
8870
8875
  ours: ref,
8871
8876
  theirs: fetchHead,
8877
+ fastForward,
8872
8878
  fastForwardOnly,
8873
8879
  message: `Merge ${fetchHeadDescription}`,
8874
8880
  author,
@@ -10848,6 +10854,7 @@ async function log({
10848
10854
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
10849
10855
  * @param {string} [args.ours] - The branch receiving the merge. If undefined, defaults to the current branch.
10850
10856
  * @param {string} args.theirs - The branch to be merged
10857
+ * @param {boolean} [args.fastForward = true] - If false, create a merge commit in all cases.
10851
10858
  * @param {boolean} [args.fastForwardOnly = false] - If true, then non-fast-forward merges will throw an Error instead of performing a merge.
10852
10859
  * @param {boolean} [args.dryRun = false] - If true, simulates a merge so you can test whether it would succeed.
10853
10860
  * @param {boolean} [args.noUpdateBranch = false] - If true, does not update the branch pointer after creating the commit.
@@ -10885,6 +10892,7 @@ async function merge({
10885
10892
  gitdir = join(dir, '.git'),
10886
10893
  ours,
10887
10894
  theirs,
10895
+ fastForward = true,
10888
10896
  fastForwardOnly = false,
10889
10897
  dryRun = false,
10890
10898
  noUpdateBranch = false,
@@ -10902,7 +10910,9 @@ async function merge({
10902
10910
  const fs = new FileSystem(_fs);
10903
10911
 
10904
10912
  const author = await normalizeAuthorObject({ fs, gitdir, author: _author });
10905
- if (!author && !fastForwardOnly) throw new MissingNameError('author')
10913
+ if (!author && (!fastForwardOnly || !fastForward)) {
10914
+ throw new MissingNameError('author')
10915
+ }
10906
10916
 
10907
10917
  const committer = await normalizeCommitterObject({
10908
10918
  fs,
@@ -10910,7 +10920,7 @@ async function merge({
10910
10920
  author,
10911
10921
  committer: _committer,
10912
10922
  });
10913
- if (!committer && !fastForwardOnly) {
10923
+ if (!committer && (!fastForwardOnly || !fastForward)) {
10914
10924
  throw new MissingNameError('committer')
10915
10925
  }
10916
10926
 
@@ -10920,6 +10930,7 @@ async function merge({
10920
10930
  gitdir,
10921
10931
  ours,
10922
10932
  theirs,
10933
+ fastForward,
10923
10934
  fastForwardOnly,
10924
10935
  dryRun,
10925
10936
  noUpdateBranch,
@@ -11124,6 +11135,7 @@ async function packObjects({
11124
11135
  * @param {string} [args.remoteRef] - (Added in 1.1.0) The name of the branch on the remote to fetch. By default this is the configured remote tracking branch.
11125
11136
  * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.
11126
11137
  * @param {boolean} [args.singleBranch = false] - Instead of the default behavior of fetching all the branches, only fetch a single branch.
11138
+ * @param {boolean} [args.fastForward = true] - If false, only create merge commits.
11127
11139
  * @param {boolean} [args.fastForwardOnly = false] - Only perform simple fast-forward merges. (Don't create merge commits.)
11128
11140
  * @param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config
11129
11141
  * @param {Object} [args.author] - The details about the author.
@@ -11166,6 +11178,7 @@ async function pull({
11166
11178
  url,
11167
11179
  remote,
11168
11180
  remoteRef,
11181
+ fastForward = true,
11169
11182
  fastForwardOnly = false,
11170
11183
  corsProxy,
11171
11184
  singleBranch,
@@ -11207,6 +11220,7 @@ async function pull({
11207
11220
  url,
11208
11221
  remote,
11209
11222
  remoteRef,
11223
+ fastForward,
11210
11224
  fastForwardOnly,
11211
11225
  corsProxy,
11212
11226
  singleBranch,
@@ -12749,32 +12763,47 @@ async function resetIndex({
12749
12763
  dir,
12750
12764
  gitdir = join(dir, '.git'),
12751
12765
  filepath,
12752
- ref = 'HEAD',
12766
+ ref,
12753
12767
  cache = {},
12754
12768
  }) {
12755
12769
  try {
12756
12770
  assertParameter('fs', _fs);
12757
12771
  assertParameter('gitdir', gitdir);
12758
12772
  assertParameter('filepath', filepath);
12759
- assertParameter('ref', ref);
12760
12773
 
12761
12774
  const fs = new FileSystem(_fs);
12762
- // Resolve commit
12763
- let oid = await GitRefManager.resolve({ fs, gitdir, ref });
12775
+
12776
+ let oid;
12764
12777
  let workdirOid;
12778
+
12765
12779
  try {
12766
- // Resolve blob
12767
- oid = await resolveFilepath({
12768
- fs,
12769
- cache,
12770
- gitdir,
12771
- oid,
12772
- filepath,
12773
- });
12780
+ // Resolve commit
12781
+ oid = await GitRefManager.resolve({ fs, gitdir, ref: ref || 'HEAD' });
12774
12782
  } catch (e) {
12775
- // This means we're resetting the file to a "deleted" state
12776
- oid = null;
12783
+ if (ref) {
12784
+ // Only throw the error if a ref is explicitly provided
12785
+ throw e
12786
+ }
12777
12787
  }
12788
+
12789
+ // Not having an oid at this point means `resetIndex()` was called without explicit `ref` on a new git
12790
+ // repository. If that happens, we can skip resolving the file path.
12791
+ if (oid) {
12792
+ try {
12793
+ // Resolve blob
12794
+ oid = await resolveFilepath({
12795
+ fs,
12796
+ cache,
12797
+ gitdir,
12798
+ oid,
12799
+ filepath,
12800
+ });
12801
+ } catch (e) {
12802
+ // This means we're resetting the file to a "deleted" state
12803
+ oid = null;
12804
+ }
12805
+ }
12806
+
12778
12807
  // For files that aren't in the workdir use zeros
12779
12808
  let stats = {
12780
12809
  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
  */
@@ -2093,6 +2097,7 @@ export function log({ fs, dir, gitdir, filepath, ref, depth, since, force, follo
2093
2097
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
2094
2098
  * @param {string} [args.ours] - The branch receiving the merge. If undefined, defaults to the current branch.
2095
2099
  * @param {string} args.theirs - The branch to be merged
2100
+ * @param {boolean} [args.fastForward = true] - If false, create a merge commit in all cases.
2096
2101
  * @param {boolean} [args.fastForwardOnly = false] - If true, then non-fast-forward merges will throw an Error instead of performing a merge.
2097
2102
  * @param {boolean} [args.dryRun = false] - If true, simulates a merge so you can test whether it would succeed.
2098
2103
  * @param {boolean} [args.noUpdateBranch = false] - If true, does not update the branch pointer after creating the commit.
@@ -2123,13 +2128,14 @@ export function log({ fs, dir, gitdir, filepath, ref, depth, since, force, follo
2123
2128
  * console.log(m)
2124
2129
  *
2125
2130
  */
2126
- export function merge({ fs: _fs, onSign, dir, gitdir, ours, theirs, fastForwardOnly, dryRun, noUpdateBranch, message, author: _author, committer: _committer, signingKey, cache, }: {
2131
+ export function merge({ fs: _fs, onSign, dir, gitdir, ours, theirs, fastForward, fastForwardOnly, dryRun, noUpdateBranch, message, author: _author, committer: _committer, signingKey, cache, }: {
2127
2132
  fs: CallbackFsClient | PromiseFsClient;
2128
2133
  onSign?: SignCallback;
2129
2134
  dir?: string;
2130
2135
  gitdir?: string;
2131
2136
  ours?: string;
2132
2137
  theirs: string;
2138
+ fastForward?: boolean;
2133
2139
  fastForwardOnly?: boolean;
2134
2140
  dryRun?: boolean;
2135
2141
  noUpdateBranch?: boolean;
@@ -2206,6 +2212,7 @@ export function packObjects({ fs, dir, gitdir, oids, write, cache, }: {
2206
2212
  * @param {string} [args.remoteRef] - (Added in 1.1.0) The name of the branch on the remote to fetch. By default this is the configured remote tracking branch.
2207
2213
  * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.
2208
2214
  * @param {boolean} [args.singleBranch = false] - Instead of the default behavior of fetching all the branches, only fetch a single branch.
2215
+ * @param {boolean} [args.fastForward = true] - If false, only create merge commits.
2209
2216
  * @param {boolean} [args.fastForwardOnly = false] - Only perform simple fast-forward merges. (Don't create merge commits.)
2210
2217
  * @param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config
2211
2218
  * @param {Object} [args.author] - The details about the author.
@@ -2234,7 +2241,7 @@ export function packObjects({ fs, dir, gitdir, oids, write, cache, }: {
2234
2241
  * console.log('done')
2235
2242
  *
2236
2243
  */
2237
- export function pull({ fs: _fs, http, onProgress, onMessage, onAuth, onAuthSuccess, onAuthFailure, dir, gitdir, ref, url, remote, remoteRef, fastForwardOnly, corsProxy, singleBranch, headers, author: _author, committer: _committer, signingKey, cache, }: {
2244
+ export function pull({ fs: _fs, http, onProgress, onMessage, onAuth, onAuthSuccess, onAuthFailure, dir, gitdir, ref, url, remote, remoteRef, fastForward, fastForwardOnly, corsProxy, singleBranch, headers, author: _author, committer: _committer, signingKey, cache, }: {
2238
2245
  fs: CallbackFsClient | PromiseFsClient;
2239
2246
  http: HttpClient;
2240
2247
  onProgress?: ProgressCallback;
@@ -2250,6 +2257,7 @@ export function pull({ fs: _fs, http, onProgress, onMessage, onAuth, onAuthSucce
2250
2257
  remoteRef?: string;
2251
2258
  corsProxy?: string;
2252
2259
  singleBranch?: boolean;
2260
+ fastForward?: boolean;
2253
2261
  fastForwardOnly?: boolean;
2254
2262
  headers?: {
2255
2263
  [x: string]: string;
@@ -4018,6 +4026,7 @@ declare namespace UserCanceledError {
4018
4026
  * @property {string} url - The URL to request
4019
4027
  * @property {string} [method='GET'] - The HTTP method to use
4020
4028
  * @property {Object<string, string>} [headers={}] - Headers to include in the HTTP request
4029
+ * @property {Object} [agent] - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
4021
4030
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
4022
4031
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
4023
4032
  * @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.13.0',
6871
+ agent: 'git/isomorphic-git@1.13.0',
6871
6872
  };
6872
6873
 
6873
6874
  class FIFO {
@@ -8637,6 +8638,7 @@ async function mergeBlobs({
8637
8638
  * @param {string} args.gitdir
8638
8639
  * @param {string} [args.ours]
8639
8640
  * @param {string} args.theirs
8641
+ * @param {boolean} args.fastForward
8640
8642
  * @param {boolean} args.fastForwardOnly
8641
8643
  * @param {boolean} args.dryRun
8642
8644
  * @param {boolean} args.noUpdateBranch
@@ -8663,6 +8665,7 @@ async function _merge({
8663
8665
  gitdir,
8664
8666
  ours,
8665
8667
  theirs,
8668
+ fastForward = true,
8666
8669
  fastForwardOnly = false,
8667
8670
  dryRun = false,
8668
8671
  noUpdateBranch = false,
@@ -8713,7 +8716,7 @@ async function _merge({
8713
8716
  alreadyMerged: true,
8714
8717
  }
8715
8718
  }
8716
- if (baseOid === ourOid) {
8719
+ if (fastForward && baseOid === ourOid) {
8717
8720
  if (!dryRun && !noUpdateBranch) {
8718
8721
  await GitRefManager.writeRef({ fs, gitdir, ref: ours, value: theirOid });
8719
8722
  }
@@ -8787,6 +8790,7 @@ async function _merge({
8787
8790
  * @param {string} [args.remoteRef]
8788
8791
  * @param {string} [args.corsProxy]
8789
8792
  * @param {boolean} args.singleBranch
8793
+ * @param {boolean} args.fastForward
8790
8794
  * @param {boolean} args.fastForwardOnly
8791
8795
  * @param {Object<string, string>} [args.headers]
8792
8796
  * @param {Object} args.author
@@ -8819,6 +8823,7 @@ async function _pull({
8819
8823
  url,
8820
8824
  remote,
8821
8825
  remoteRef,
8826
+ fastForward,
8822
8827
  fastForwardOnly,
8823
8828
  corsProxy,
8824
8829
  singleBranch,
@@ -8863,6 +8868,7 @@ async function _pull({
8863
8868
  gitdir,
8864
8869
  ours: ref,
8865
8870
  theirs: fetchHead,
8871
+ fastForward,
8866
8872
  fastForwardOnly,
8867
8873
  message: `Merge ${fetchHeadDescription}`,
8868
8874
  author,
@@ -10842,6 +10848,7 @@ async function log({
10842
10848
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
10843
10849
  * @param {string} [args.ours] - The branch receiving the merge. If undefined, defaults to the current branch.
10844
10850
  * @param {string} args.theirs - The branch to be merged
10851
+ * @param {boolean} [args.fastForward = true] - If false, create a merge commit in all cases.
10845
10852
  * @param {boolean} [args.fastForwardOnly = false] - If true, then non-fast-forward merges will throw an Error instead of performing a merge.
10846
10853
  * @param {boolean} [args.dryRun = false] - If true, simulates a merge so you can test whether it would succeed.
10847
10854
  * @param {boolean} [args.noUpdateBranch = false] - If true, does not update the branch pointer after creating the commit.
@@ -10879,6 +10886,7 @@ async function merge({
10879
10886
  gitdir = join(dir, '.git'),
10880
10887
  ours,
10881
10888
  theirs,
10889
+ fastForward = true,
10882
10890
  fastForwardOnly = false,
10883
10891
  dryRun = false,
10884
10892
  noUpdateBranch = false,
@@ -10896,7 +10904,9 @@ async function merge({
10896
10904
  const fs = new FileSystem(_fs);
10897
10905
 
10898
10906
  const author = await normalizeAuthorObject({ fs, gitdir, author: _author });
10899
- if (!author && !fastForwardOnly) throw new MissingNameError('author')
10907
+ if (!author && (!fastForwardOnly || !fastForward)) {
10908
+ throw new MissingNameError('author')
10909
+ }
10900
10910
 
10901
10911
  const committer = await normalizeCommitterObject({
10902
10912
  fs,
@@ -10904,7 +10914,7 @@ async function merge({
10904
10914
  author,
10905
10915
  committer: _committer,
10906
10916
  });
10907
- if (!committer && !fastForwardOnly) {
10917
+ if (!committer && (!fastForwardOnly || !fastForward)) {
10908
10918
  throw new MissingNameError('committer')
10909
10919
  }
10910
10920
 
@@ -10914,6 +10924,7 @@ async function merge({
10914
10924
  gitdir,
10915
10925
  ours,
10916
10926
  theirs,
10927
+ fastForward,
10917
10928
  fastForwardOnly,
10918
10929
  dryRun,
10919
10930
  noUpdateBranch,
@@ -11118,6 +11129,7 @@ async function packObjects({
11118
11129
  * @param {string} [args.remoteRef] - (Added in 1.1.0) The name of the branch on the remote to fetch. By default this is the configured remote tracking branch.
11119
11130
  * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.
11120
11131
  * @param {boolean} [args.singleBranch = false] - Instead of the default behavior of fetching all the branches, only fetch a single branch.
11132
+ * @param {boolean} [args.fastForward = true] - If false, only create merge commits.
11121
11133
  * @param {boolean} [args.fastForwardOnly = false] - Only perform simple fast-forward merges. (Don't create merge commits.)
11122
11134
  * @param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config
11123
11135
  * @param {Object} [args.author] - The details about the author.
@@ -11160,6 +11172,7 @@ async function pull({
11160
11172
  url,
11161
11173
  remote,
11162
11174
  remoteRef,
11175
+ fastForward = true,
11163
11176
  fastForwardOnly = false,
11164
11177
  corsProxy,
11165
11178
  singleBranch,
@@ -11201,6 +11214,7 @@ async function pull({
11201
11214
  url,
11202
11215
  remote,
11203
11216
  remoteRef,
11217
+ fastForward,
11204
11218
  fastForwardOnly,
11205
11219
  corsProxy,
11206
11220
  singleBranch,
@@ -12743,32 +12757,47 @@ async function resetIndex({
12743
12757
  dir,
12744
12758
  gitdir = join(dir, '.git'),
12745
12759
  filepath,
12746
- ref = 'HEAD',
12760
+ ref,
12747
12761
  cache = {},
12748
12762
  }) {
12749
12763
  try {
12750
12764
  assertParameter('fs', _fs);
12751
12765
  assertParameter('gitdir', gitdir);
12752
12766
  assertParameter('filepath', filepath);
12753
- assertParameter('ref', ref);
12754
12767
 
12755
12768
  const fs = new FileSystem(_fs);
12756
- // Resolve commit
12757
- let oid = await GitRefManager.resolve({ fs, gitdir, ref });
12769
+
12770
+ let oid;
12758
12771
  let workdirOid;
12772
+
12759
12773
  try {
12760
- // Resolve blob
12761
- oid = await resolveFilepath({
12762
- fs,
12763
- cache,
12764
- gitdir,
12765
- oid,
12766
- filepath,
12767
- });
12774
+ // Resolve commit
12775
+ oid = await GitRefManager.resolve({ fs, gitdir, ref: ref || 'HEAD' });
12768
12776
  } catch (e) {
12769
- // This means we're resetting the file to a "deleted" state
12770
- oid = null;
12777
+ if (ref) {
12778
+ // Only throw the error if a ref is explicitly provided
12779
+ throw e
12780
+ }
12771
12781
  }
12782
+
12783
+ // Not having an oid at this point means `resetIndex()` was called without explicit `ref` on a new git
12784
+ // repository. If that happens, we can skip resolving the file path.
12785
+ if (oid) {
12786
+ try {
12787
+ // Resolve blob
12788
+ oid = await resolveFilepath({
12789
+ fs,
12790
+ cache,
12791
+ gitdir,
12792
+ oid,
12793
+ filepath,
12794
+ });
12795
+ } catch (e) {
12796
+ // This means we're resetting the file to a "deleted" state
12797
+ oid = null;
12798
+ }
12799
+ }
12800
+
12772
12801
  // For files that aren't in the workdir use zeros
12773
12802
  let stats = {
12774
12803
  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
  */
@@ -2093,6 +2097,7 @@ export function log({ fs, dir, gitdir, filepath, ref, depth, since, force, follo
2093
2097
  * @param {string} [args.gitdir=join(dir,'.git')] - [required] The [git directory](dir-vs-gitdir.md) path
2094
2098
  * @param {string} [args.ours] - The branch receiving the merge. If undefined, defaults to the current branch.
2095
2099
  * @param {string} args.theirs - The branch to be merged
2100
+ * @param {boolean} [args.fastForward = true] - If false, create a merge commit in all cases.
2096
2101
  * @param {boolean} [args.fastForwardOnly = false] - If true, then non-fast-forward merges will throw an Error instead of performing a merge.
2097
2102
  * @param {boolean} [args.dryRun = false] - If true, simulates a merge so you can test whether it would succeed.
2098
2103
  * @param {boolean} [args.noUpdateBranch = false] - If true, does not update the branch pointer after creating the commit.
@@ -2123,13 +2128,14 @@ export function log({ fs, dir, gitdir, filepath, ref, depth, since, force, follo
2123
2128
  * console.log(m)
2124
2129
  *
2125
2130
  */
2126
- export function merge({ fs: _fs, onSign, dir, gitdir, ours, theirs, fastForwardOnly, dryRun, noUpdateBranch, message, author: _author, committer: _committer, signingKey, cache, }: {
2131
+ export function merge({ fs: _fs, onSign, dir, gitdir, ours, theirs, fastForward, fastForwardOnly, dryRun, noUpdateBranch, message, author: _author, committer: _committer, signingKey, cache, }: {
2127
2132
  fs: CallbackFsClient | PromiseFsClient;
2128
2133
  onSign?: SignCallback;
2129
2134
  dir?: string;
2130
2135
  gitdir?: string;
2131
2136
  ours?: string;
2132
2137
  theirs: string;
2138
+ fastForward?: boolean;
2133
2139
  fastForwardOnly?: boolean;
2134
2140
  dryRun?: boolean;
2135
2141
  noUpdateBranch?: boolean;
@@ -2206,6 +2212,7 @@ export function packObjects({ fs, dir, gitdir, oids, write, cache, }: {
2206
2212
  * @param {string} [args.remoteRef] - (Added in 1.1.0) The name of the branch on the remote to fetch. By default this is the configured remote tracking branch.
2207
2213
  * @param {string} [args.corsProxy] - Optional [CORS proxy](https://www.npmjs.com/%40isomorphic-git/cors-proxy). Overrides value in repo config.
2208
2214
  * @param {boolean} [args.singleBranch = false] - Instead of the default behavior of fetching all the branches, only fetch a single branch.
2215
+ * @param {boolean} [args.fastForward = true] - If false, only create merge commits.
2209
2216
  * @param {boolean} [args.fastForwardOnly = false] - Only perform simple fast-forward merges. (Don't create merge commits.)
2210
2217
  * @param {Object<string, string>} [args.headers] - Additional headers to include in HTTP requests, similar to git's `extraHeader` config
2211
2218
  * @param {Object} [args.author] - The details about the author.
@@ -2234,7 +2241,7 @@ export function packObjects({ fs, dir, gitdir, oids, write, cache, }: {
2234
2241
  * console.log('done')
2235
2242
  *
2236
2243
  */
2237
- export function pull({ fs: _fs, http, onProgress, onMessage, onAuth, onAuthSuccess, onAuthFailure, dir, gitdir, ref, url, remote, remoteRef, fastForwardOnly, corsProxy, singleBranch, headers, author: _author, committer: _committer, signingKey, cache, }: {
2244
+ export function pull({ fs: _fs, http, onProgress, onMessage, onAuth, onAuthSuccess, onAuthFailure, dir, gitdir, ref, url, remote, remoteRef, fastForward, fastForwardOnly, corsProxy, singleBranch, headers, author: _author, committer: _committer, signingKey, cache, }: {
2238
2245
  fs: CallbackFsClient | PromiseFsClient;
2239
2246
  http: HttpClient;
2240
2247
  onProgress?: ProgressCallback;
@@ -2250,6 +2257,7 @@ export function pull({ fs: _fs, http, onProgress, onMessage, onAuth, onAuthSucce
2250
2257
  remoteRef?: string;
2251
2258
  corsProxy?: string;
2252
2259
  singleBranch?: boolean;
2260
+ fastForward?: boolean;
2253
2261
  fastForwardOnly?: boolean;
2254
2262
  headers?: {
2255
2263
  [x: string]: string;
@@ -4018,6 +4026,7 @@ declare namespace UserCanceledError {
4018
4026
  * @property {string} url - The URL to request
4019
4027
  * @property {string} [method='GET'] - The HTTP method to use
4020
4028
  * @property {Object<string, string>} [headers={}] - Headers to include in the HTTP request
4029
+ * @property {Object} [agent] - An HTTP or HTTPS agent that manages connections for the HTTP client (Node.js only)
4021
4030
  * @property {AsyncIterableIterator<Uint8Array>} [body] - An async iterator of Uint8Arrays that make up the body of POST requests
4022
4031
  * @property {ProgressCallback} [onProgress] - Reserved for future use (emitting `GitProgressEvent`s)
4023
4032
  * @property {object} [signal] - Reserved for future use (canceling a request)