isomorphic-git 1.24.5 → 1.25.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
@@ -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,12 @@
1
1
  [
2
+ "X Chrome Headless 79.0.3945.0 (Linux x86_64)",
3
+ "Firefox 119.0 (Ubuntu 0.0.0)",
4
+ "Chrome 117.0.0.0 (Android 10)",
5
+ "Edge 79.0.309.65 (Windows 10)",
6
+ "X Safari 13.1 (Mac OS 10.15.4)",
7
+ "X Mobile Safari 13.0 (iOS 13.0)",
2
8
  "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)",
9
+ "Chrome 117.0.0.0 (Android 10)",
5
10
  "Safari 13.1 (Mac OS 10.15.4)",
6
- "Edge 79.0.309.65 (Windows 10)",
7
11
  "Mobile Safari 13.0 (iOS 13.0)"
8
12
  ]
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.0',
7320
+ agent: 'git/isomorphic-git@1.25.0',
7318
7321
  };
7319
7322
 
7320
7323
  class FIFO {
@@ -8878,6 +8881,9 @@ async function mergeTree({
8878
8881
  const theirTree = TREE({ ref: theirOid });
8879
8882
 
8880
8883
  const unmergedFiles = [];
8884
+ const bothModified = [];
8885
+ const deleteByUs = [];
8886
+ const deleteByTheirs = [];
8881
8887
 
8882
8888
  const results = await _walk({
8883
8889
  fs,
@@ -8943,6 +8949,7 @@ async function mergeTree({
8943
8949
  }).then(async r => {
8944
8950
  if (!r.cleanMerge) {
8945
8951
  unmergedFiles.push(filepath);
8952
+ bothModified.push(filepath);
8946
8953
  if (!abortOnConflict) {
8947
8954
  const baseOid = await base.oid();
8948
8955
  const ourOid = await ours.oid();
@@ -8960,8 +8967,70 @@ async function mergeTree({
8960
8967
  return r.mergeResult
8961
8968
  })
8962
8969
  }
8970
+
8971
+ // deleted by us
8972
+ if (
8973
+ base &&
8974
+ !ours &&
8975
+ theirs &&
8976
+ (await base.type()) === 'blob' &&
8977
+ (await theirs.type()) === 'blob'
8978
+ ) {
8979
+ unmergedFiles.push(filepath);
8980
+ deleteByUs.push(filepath);
8981
+ if (!abortOnConflict) {
8982
+ const baseOid = await base.oid();
8983
+ const theirOid = await theirs.oid();
8984
+
8985
+ index.delete({ filepath });
8986
+
8987
+ index.insert({ filepath, oid: baseOid, stage: 1 });
8988
+ index.insert({ filepath, oid: theirOid, stage: 3 });
8989
+ }
8990
+
8991
+ return {
8992
+ mode: await theirs.mode(),
8993
+ oid: await theirs.oid(),
8994
+ type: 'blob',
8995
+ path,
8996
+ }
8997
+ }
8998
+
8999
+ // deleted by theirs
9000
+ if (
9001
+ base &&
9002
+ ours &&
9003
+ !theirs &&
9004
+ (await base.type()) === 'blob' &&
9005
+ (await ours.type()) === 'blob'
9006
+ ) {
9007
+ unmergedFiles.push(filepath);
9008
+ deleteByTheirs.push(filepath);
9009
+ if (!abortOnConflict) {
9010
+ const baseOid = await base.oid();
9011
+ const ourOid = await ours.oid();
9012
+
9013
+ index.delete({ filepath });
9014
+
9015
+ index.insert({ filepath, oid: baseOid, stage: 1 });
9016
+ index.insert({ filepath, oid: ourOid, stage: 2 });
9017
+ }
9018
+
9019
+ return {
9020
+ mode: await ours.mode(),
9021
+ oid: await ours.oid(),
9022
+ type: 'blob',
9023
+ path,
9024
+ }
9025
+ }
9026
+
9027
+ // deleted by both
9028
+ if (base && !ours && !theirs && (await base.type()) === 'blob') {
9029
+ return undefined
9030
+ }
9031
+
8963
9032
  // all other types of conflicts fail
8964
- // TODO: Merge conflicts involving deletions/additions
9033
+ // TODO: Merge conflicts involving additions
8965
9034
  throw new MergeNotSupportedError()
8966
9035
  }
8967
9036
  }
@@ -9017,7 +9086,12 @@ async function mergeTree({
9017
9086
  },
9018
9087
  });
9019
9088
  }
9020
- return new MergeConflictError(unmergedFiles)
9089
+ return new MergeConflictError(
9090
+ unmergedFiles,
9091
+ bothModified,
9092
+ deleteByUs,
9093
+ deleteByTheirs
9094
+ )
9021
9095
  }
9022
9096
 
9023
9097
  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.0',
7314
+ agent: 'git/isomorphic-git@1.25.0',
7312
7315
  };
7313
7316
 
7314
7317
  class FIFO {
@@ -8872,6 +8875,9 @@ async function mergeTree({
8872
8875
  const theirTree = TREE({ ref: theirOid });
8873
8876
 
8874
8877
  const unmergedFiles = [];
8878
+ const bothModified = [];
8879
+ const deleteByUs = [];
8880
+ const deleteByTheirs = [];
8875
8881
 
8876
8882
  const results = await _walk({
8877
8883
  fs,
@@ -8937,6 +8943,7 @@ async function mergeTree({
8937
8943
  }).then(async r => {
8938
8944
  if (!r.cleanMerge) {
8939
8945
  unmergedFiles.push(filepath);
8946
+ bothModified.push(filepath);
8940
8947
  if (!abortOnConflict) {
8941
8948
  const baseOid = await base.oid();
8942
8949
  const ourOid = await ours.oid();
@@ -8954,8 +8961,70 @@ async function mergeTree({
8954
8961
  return r.mergeResult
8955
8962
  })
8956
8963
  }
8964
+
8965
+ // deleted by us
8966
+ if (
8967
+ base &&
8968
+ !ours &&
8969
+ theirs &&
8970
+ (await base.type()) === 'blob' &&
8971
+ (await theirs.type()) === 'blob'
8972
+ ) {
8973
+ unmergedFiles.push(filepath);
8974
+ deleteByUs.push(filepath);
8975
+ if (!abortOnConflict) {
8976
+ const baseOid = await base.oid();
8977
+ const theirOid = await theirs.oid();
8978
+
8979
+ index.delete({ filepath });
8980
+
8981
+ index.insert({ filepath, oid: baseOid, stage: 1 });
8982
+ index.insert({ filepath, oid: theirOid, stage: 3 });
8983
+ }
8984
+
8985
+ return {
8986
+ mode: await theirs.mode(),
8987
+ oid: await theirs.oid(),
8988
+ type: 'blob',
8989
+ path,
8990
+ }
8991
+ }
8992
+
8993
+ // deleted by theirs
8994
+ if (
8995
+ base &&
8996
+ ours &&
8997
+ !theirs &&
8998
+ (await base.type()) === 'blob' &&
8999
+ (await ours.type()) === 'blob'
9000
+ ) {
9001
+ unmergedFiles.push(filepath);
9002
+ deleteByTheirs.push(filepath);
9003
+ if (!abortOnConflict) {
9004
+ const baseOid = await base.oid();
9005
+ const ourOid = await ours.oid();
9006
+
9007
+ index.delete({ filepath });
9008
+
9009
+ index.insert({ filepath, oid: baseOid, stage: 1 });
9010
+ index.insert({ filepath, oid: ourOid, stage: 2 });
9011
+ }
9012
+
9013
+ return {
9014
+ mode: await ours.mode(),
9015
+ oid: await ours.oid(),
9016
+ type: 'blob',
9017
+ path,
9018
+ }
9019
+ }
9020
+
9021
+ // deleted by both
9022
+ if (base && !ours && !theirs && (await base.type()) === 'blob') {
9023
+ return undefined
9024
+ }
9025
+
8957
9026
  // all other types of conflicts fail
8958
- // TODO: Merge conflicts involving deletions/additions
9027
+ // TODO: Merge conflicts involving additions
8959
9028
  throw new MergeNotSupportedError()
8960
9029
  }
8961
9030
  }
@@ -9011,7 +9080,12 @@ async function mergeTree({
9011
9080
  },
9012
9081
  });
9013
9082
  }
9014
- return new MergeConflictError(unmergedFiles)
9083
+ return new MergeConflictError(
9084
+ unmergedFiles,
9085
+ bothModified,
9086
+ deleteByUs,
9087
+ deleteByTheirs
9088
+ )
9015
9089
  }
9016
9090
 
9017
9091
  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 {