isomorphic-git 1.24.5 → 1.25.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
@@ -363,6 +363,9 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
363
363
  <td align="center"><a href="https://github.com/barry963"><img src="https://avatars.githubusercontent.com/u/5289896?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Barry</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=barry963" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=barry963" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=barry963" title="Tests">⚠️</a></td>
364
364
  <td align="center"><a href="https://stackoverflow.com/users/1493081/alireza-mirian"><img src="https://avatars.githubusercontent.com/u/3150694?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Alireza Mirian</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=alirezamirian" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=alirezamirian" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=alirezamirian" title="Tests">⚠️</a> <a href="https://github.com/isomorphic-git/isomorphic-git/issues?q=author%3Aalirezamirian" title="Bug reports">🐛</a></td>
365
365
  </tr>
366
+ <tr>
367
+ <td align="center"><a href="https://github.com/DanilKazanov"><img src="https://avatars.githubusercontent.com/u/139755256?v=4?s=60" width="60px;" alt=""/><br /><sub><b>DanilKazanov</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=DanilKazanov" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=DanilKazanov" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=DanilKazanov" title="Tests">⚠️</a></td>
368
+ </tr>
366
369
  </table>
367
370
 
368
371
  <!-- markdownlint-restore -->
@@ -1,8 +1,11 @@
1
1
  [
2
2
  "Chrome Headless 79.0.3945.0 (Linux x86_64)",
3
- "Firefox 115.0 (Ubuntu 0.0.0)",
4
- "Chrome 114.0.0.0 (Android 10)",
5
- "Safari 13.1 (Mac OS 10.15.4)",
3
+ "X Firefox 120.0 (Ubuntu 0.0.0)",
4
+ "Chrome 117.0.0.0 (Android 10)",
6
5
  "Edge 79.0.309.65 (Windows 10)",
7
- "Mobile Safari 13.0 (iOS 13.0)"
6
+ "Safari 13.1 (Mac OS 10.15.4)",
7
+ "Mobile Safari 13.0 (iOS 13.0)",
8
+ "Chrome Headless 79.0.3945.0 (Linux x86_64)",
9
+ "Firefox 120.0 (Ubuntu 0.0.0)",
10
+ "Chrome 117.0.0.0 (Android 10)"
8
11
  ]
@@ -213,15 +213,19 @@ async function request({
213
213
  },
214
214
  (err, res) => {
215
215
  if (err) return reject(err)
216
- const iter = fromNodeStream(res);
217
- resolve({
218
- url: res.url,
219
- method: res.method,
220
- statusCode: res.statusCode,
221
- statusMessage: res.statusMessage,
222
- body: iter,
223
- headers: res.headers,
224
- });
216
+ try {
217
+ const iter = fromNodeStream(res);
218
+ resolve({
219
+ url: res.url,
220
+ method: res.method,
221
+ statusCode: res.statusCode,
222
+ statusMessage: res.statusMessage,
223
+ body: iter,
224
+ headers: res.headers,
225
+ });
226
+ } catch (e) {
227
+ reject(e);
228
+ }
225
229
  }
226
230
  );
227
231
  })
@@ -207,15 +207,19 @@ async function request({
207
207
  },
208
208
  (err, res) => {
209
209
  if (err) return reject(err)
210
- const iter = fromNodeStream(res);
211
- resolve({
212
- url: res.url,
213
- method: res.method,
214
- statusCode: res.statusCode,
215
- statusMessage: res.statusMessage,
216
- body: iter,
217
- headers: res.headers,
218
- });
210
+ try {
211
+ const iter = fromNodeStream(res);
212
+ resolve({
213
+ url: res.url,
214
+ method: res.method,
215
+ statusCode: res.statusCode,
216
+ statusMessage: res.statusMessage,
217
+ body: iter,
218
+ headers: res.headers,
219
+ });
220
+ } catch (e) {
221
+ reject(e);
222
+ }
219
223
  }
220
224
  );
221
225
  })
package/index.cjs CHANGED
@@ -3312,13 +3312,16 @@ MergeNotSupportedError.code = 'MergeNotSupportedError';
3312
3312
  class MergeConflictError extends BaseError {
3313
3313
  /**
3314
3314
  * @param {Array<string>} filepaths
3315
+ * @param {Array<string>} bothModified
3316
+ * @param {Array<string>} deleteByUs
3317
+ * @param {Array<string>} deleteByTheirs
3315
3318
  */
3316
- constructor(filepaths) {
3319
+ constructor(filepaths, bothModified, deleteByUs, deleteByTheirs) {
3317
3320
  super(
3318
3321
  `Automatic merge failed with one or more merge conflicts in the following files: ${filepaths.toString()}. Fix conflicts then commit the result.`
3319
3322
  );
3320
3323
  this.code = this.name = MergeConflictError.code;
3321
- this.data = { filepaths };
3324
+ this.data = { filepaths, bothModified, deleteByUs, deleteByTheirs };
3322
3325
  }
3323
3326
  }
3324
3327
  /** @type {'MergeConflictError'} */
@@ -7313,8 +7316,8 @@ function filterCapabilities(server, client) {
7313
7316
 
7314
7317
  const pkg = {
7315
7318
  name: 'isomorphic-git',
7316
- version: '1.24.5',
7317
- agent: 'git/isomorphic-git@1.24.5',
7319
+ version: '1.25.1',
7320
+ agent: 'git/isomorphic-git@1.25.1',
7318
7321
  };
7319
7322
 
7320
7323
  class FIFO {
@@ -7578,6 +7581,9 @@ async function parseUploadPackResponse(stream) {
7578
7581
  } else if (line.startsWith('NAK')) {
7579
7582
  nak = true;
7580
7583
  done = true;
7584
+ } else {
7585
+ done = true;
7586
+ nak = true;
7581
7587
  }
7582
7588
  if (done) {
7583
7589
  resolve({ shallows, unshallows, acks, nak, packfile, progress });
@@ -8878,6 +8884,9 @@ async function mergeTree({
8878
8884
  const theirTree = TREE({ ref: theirOid });
8879
8885
 
8880
8886
  const unmergedFiles = [];
8887
+ const bothModified = [];
8888
+ const deleteByUs = [];
8889
+ const deleteByTheirs = [];
8881
8890
 
8882
8891
  const results = await _walk({
8883
8892
  fs,
@@ -8943,6 +8952,7 @@ async function mergeTree({
8943
8952
  }).then(async r => {
8944
8953
  if (!r.cleanMerge) {
8945
8954
  unmergedFiles.push(filepath);
8955
+ bothModified.push(filepath);
8946
8956
  if (!abortOnConflict) {
8947
8957
  const baseOid = await base.oid();
8948
8958
  const ourOid = await ours.oid();
@@ -8960,8 +8970,70 @@ async function mergeTree({
8960
8970
  return r.mergeResult
8961
8971
  })
8962
8972
  }
8973
+
8974
+ // deleted by us
8975
+ if (
8976
+ base &&
8977
+ !ours &&
8978
+ theirs &&
8979
+ (await base.type()) === 'blob' &&
8980
+ (await theirs.type()) === 'blob'
8981
+ ) {
8982
+ unmergedFiles.push(filepath);
8983
+ deleteByUs.push(filepath);
8984
+ if (!abortOnConflict) {
8985
+ const baseOid = await base.oid();
8986
+ const theirOid = await theirs.oid();
8987
+
8988
+ index.delete({ filepath });
8989
+
8990
+ index.insert({ filepath, oid: baseOid, stage: 1 });
8991
+ index.insert({ filepath, oid: theirOid, stage: 3 });
8992
+ }
8993
+
8994
+ return {
8995
+ mode: await theirs.mode(),
8996
+ oid: await theirs.oid(),
8997
+ type: 'blob',
8998
+ path,
8999
+ }
9000
+ }
9001
+
9002
+ // deleted by theirs
9003
+ if (
9004
+ base &&
9005
+ ours &&
9006
+ !theirs &&
9007
+ (await base.type()) === 'blob' &&
9008
+ (await ours.type()) === 'blob'
9009
+ ) {
9010
+ unmergedFiles.push(filepath);
9011
+ deleteByTheirs.push(filepath);
9012
+ if (!abortOnConflict) {
9013
+ const baseOid = await base.oid();
9014
+ const ourOid = await ours.oid();
9015
+
9016
+ index.delete({ filepath });
9017
+
9018
+ index.insert({ filepath, oid: baseOid, stage: 1 });
9019
+ index.insert({ filepath, oid: ourOid, stage: 2 });
9020
+ }
9021
+
9022
+ return {
9023
+ mode: await ours.mode(),
9024
+ oid: await ours.oid(),
9025
+ type: 'blob',
9026
+ path,
9027
+ }
9028
+ }
9029
+
9030
+ // deleted by both
9031
+ if (base && !ours && !theirs && (await base.type()) === 'blob') {
9032
+ return undefined
9033
+ }
9034
+
8963
9035
  // all other types of conflicts fail
8964
- // TODO: Merge conflicts involving deletions/additions
9036
+ // TODO: Merge conflicts involving additions
8965
9037
  throw new MergeNotSupportedError()
8966
9038
  }
8967
9039
  }
@@ -9017,7 +9089,12 @@ async function mergeTree({
9017
9089
  },
9018
9090
  });
9019
9091
  }
9020
- return new MergeConflictError(unmergedFiles)
9092
+ return new MergeConflictError(
9093
+ unmergedFiles,
9094
+ bothModified,
9095
+ deleteByUs,
9096
+ deleteByTheirs
9097
+ )
9021
9098
  }
9022
9099
 
9023
9100
  return results.oid
package/index.d.ts CHANGED
@@ -3981,12 +3981,18 @@ declare namespace MergeNotSupportedError {
3981
3981
  declare class MergeConflictError extends BaseError {
3982
3982
  /**
3983
3983
  * @param {Array<string>} filepaths
3984
+ * @param {Array<string>} bothModified
3985
+ * @param {Array<string>} deleteByUs
3986
+ * @param {Array<string>} deleteByTheirs
3984
3987
  */
3985
- constructor(filepaths: string[]);
3988
+ constructor(filepaths: string[], bothModified: string[], deleteByUs: string[], deleteByTheirs: string[]);
3986
3989
  code: "MergeConflictError";
3987
3990
  name: "MergeConflictError";
3988
3991
  data: {
3989
3992
  filepaths: string[];
3993
+ bothModified: string[];
3994
+ deleteByUs: string[];
3995
+ deleteByTheirs: string[];
3990
3996
  };
3991
3997
  }
3992
3998
  declare namespace MergeConflictError {
package/index.js CHANGED
@@ -3306,13 +3306,16 @@ MergeNotSupportedError.code = 'MergeNotSupportedError';
3306
3306
  class MergeConflictError extends BaseError {
3307
3307
  /**
3308
3308
  * @param {Array<string>} filepaths
3309
+ * @param {Array<string>} bothModified
3310
+ * @param {Array<string>} deleteByUs
3311
+ * @param {Array<string>} deleteByTheirs
3309
3312
  */
3310
- constructor(filepaths) {
3313
+ constructor(filepaths, bothModified, deleteByUs, deleteByTheirs) {
3311
3314
  super(
3312
3315
  `Automatic merge failed with one or more merge conflicts in the following files: ${filepaths.toString()}. Fix conflicts then commit the result.`
3313
3316
  );
3314
3317
  this.code = this.name = MergeConflictError.code;
3315
- this.data = { filepaths };
3318
+ this.data = { filepaths, bothModified, deleteByUs, deleteByTheirs };
3316
3319
  }
3317
3320
  }
3318
3321
  /** @type {'MergeConflictError'} */
@@ -7307,8 +7310,8 @@ function filterCapabilities(server, client) {
7307
7310
 
7308
7311
  const pkg = {
7309
7312
  name: 'isomorphic-git',
7310
- version: '1.24.5',
7311
- agent: 'git/isomorphic-git@1.24.5',
7313
+ version: '1.25.1',
7314
+ agent: 'git/isomorphic-git@1.25.1',
7312
7315
  };
7313
7316
 
7314
7317
  class FIFO {
@@ -7572,6 +7575,9 @@ async function parseUploadPackResponse(stream) {
7572
7575
  } else if (line.startsWith('NAK')) {
7573
7576
  nak = true;
7574
7577
  done = true;
7578
+ } else {
7579
+ done = true;
7580
+ nak = true;
7575
7581
  }
7576
7582
  if (done) {
7577
7583
  resolve({ shallows, unshallows, acks, nak, packfile, progress });
@@ -8872,6 +8878,9 @@ async function mergeTree({
8872
8878
  const theirTree = TREE({ ref: theirOid });
8873
8879
 
8874
8880
  const unmergedFiles = [];
8881
+ const bothModified = [];
8882
+ const deleteByUs = [];
8883
+ const deleteByTheirs = [];
8875
8884
 
8876
8885
  const results = await _walk({
8877
8886
  fs,
@@ -8937,6 +8946,7 @@ async function mergeTree({
8937
8946
  }).then(async r => {
8938
8947
  if (!r.cleanMerge) {
8939
8948
  unmergedFiles.push(filepath);
8949
+ bothModified.push(filepath);
8940
8950
  if (!abortOnConflict) {
8941
8951
  const baseOid = await base.oid();
8942
8952
  const ourOid = await ours.oid();
@@ -8954,8 +8964,70 @@ async function mergeTree({
8954
8964
  return r.mergeResult
8955
8965
  })
8956
8966
  }
8967
+
8968
+ // deleted by us
8969
+ if (
8970
+ base &&
8971
+ !ours &&
8972
+ theirs &&
8973
+ (await base.type()) === 'blob' &&
8974
+ (await theirs.type()) === 'blob'
8975
+ ) {
8976
+ unmergedFiles.push(filepath);
8977
+ deleteByUs.push(filepath);
8978
+ if (!abortOnConflict) {
8979
+ const baseOid = await base.oid();
8980
+ const theirOid = await theirs.oid();
8981
+
8982
+ index.delete({ filepath });
8983
+
8984
+ index.insert({ filepath, oid: baseOid, stage: 1 });
8985
+ index.insert({ filepath, oid: theirOid, stage: 3 });
8986
+ }
8987
+
8988
+ return {
8989
+ mode: await theirs.mode(),
8990
+ oid: await theirs.oid(),
8991
+ type: 'blob',
8992
+ path,
8993
+ }
8994
+ }
8995
+
8996
+ // deleted by theirs
8997
+ if (
8998
+ base &&
8999
+ ours &&
9000
+ !theirs &&
9001
+ (await base.type()) === 'blob' &&
9002
+ (await ours.type()) === 'blob'
9003
+ ) {
9004
+ unmergedFiles.push(filepath);
9005
+ deleteByTheirs.push(filepath);
9006
+ if (!abortOnConflict) {
9007
+ const baseOid = await base.oid();
9008
+ const ourOid = await ours.oid();
9009
+
9010
+ index.delete({ filepath });
9011
+
9012
+ index.insert({ filepath, oid: baseOid, stage: 1 });
9013
+ index.insert({ filepath, oid: ourOid, stage: 2 });
9014
+ }
9015
+
9016
+ return {
9017
+ mode: await ours.mode(),
9018
+ oid: await ours.oid(),
9019
+ type: 'blob',
9020
+ path,
9021
+ }
9022
+ }
9023
+
9024
+ // deleted by both
9025
+ if (base && !ours && !theirs && (await base.type()) === 'blob') {
9026
+ return undefined
9027
+ }
9028
+
8957
9029
  // all other types of conflicts fail
8958
- // TODO: Merge conflicts involving deletions/additions
9030
+ // TODO: Merge conflicts involving additions
8959
9031
  throw new MergeNotSupportedError()
8960
9032
  }
8961
9033
  }
@@ -9011,7 +9083,12 @@ async function mergeTree({
9011
9083
  },
9012
9084
  });
9013
9085
  }
9014
- return new MergeConflictError(unmergedFiles)
9086
+ return new MergeConflictError(
9087
+ unmergedFiles,
9088
+ bothModified,
9089
+ deleteByUs,
9090
+ deleteByTheirs
9091
+ )
9015
9092
  }
9016
9093
 
9017
9094
  return results.oid
@@ -3981,12 +3981,18 @@ declare namespace MergeNotSupportedError {
3981
3981
  declare class MergeConflictError extends BaseError {
3982
3982
  /**
3983
3983
  * @param {Array<string>} filepaths
3984
+ * @param {Array<string>} bothModified
3985
+ * @param {Array<string>} deleteByUs
3986
+ * @param {Array<string>} deleteByTheirs
3984
3987
  */
3985
- constructor(filepaths: string[]);
3988
+ constructor(filepaths: string[], bothModified: string[], deleteByUs: string[], deleteByTheirs: string[]);
3986
3989
  code: "MergeConflictError";
3987
3990
  name: "MergeConflictError";
3988
3991
  data: {
3989
3992
  filepaths: string[];
3993
+ bothModified: string[];
3994
+ deleteByUs: string[];
3995
+ deleteByTheirs: string[];
3990
3996
  };
3991
3997
  }
3992
3998
  declare namespace MergeConflictError {