isomorphic-git 1.42.4 → 1.42.6
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 +1 -0
- package/index.cjs +173 -4
- package/index.d.cts +84 -64
- package/index.d.ts +84 -64
- package/index.js +173 -4
- package/index.umd.min.d.ts +84 -64
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/managers/index.cjs +64 -2
- package/managers/index.js +64 -2
- package/managers/index.umd.min.js +1 -1
- package/managers/index.umd.min.js.map +1 -1
- package/models/index.cjs +47 -2
- package/models/index.js +47 -2
- package/models/index.umd.min.js +1 -1
- package/models/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/managers/index.cjs
CHANGED
|
@@ -1071,9 +1071,54 @@ class BufferCursor {
|
|
|
1071
1071
|
}
|
|
1072
1072
|
}
|
|
1073
1073
|
|
|
1074
|
+
// Code units from U+D800 up. Only these can make the two orders differ.
|
|
1075
|
+
const NEEDS_CODE_POINT_ORDER = /[\ud800-]/;
|
|
1076
|
+
|
|
1077
|
+
// Is the code unit at index i a surrogate with no partner? Such a unit is not valid Unicode.
|
|
1078
|
+
// A high surrogate needs a low one after it. A low surrogate needs a high one before it.
|
|
1079
|
+
function isLoneSurrogate(s, i, unit) {
|
|
1080
|
+
if (unit < 0xd800 || unit > 0xdfff) return false
|
|
1081
|
+
if (unit < 0xdc00) {
|
|
1082
|
+
const next = i + 1 < s.length ? s.charCodeAt(i + 1) : 0;
|
|
1083
|
+
return next < 0xdc00 || next > 0xdfff
|
|
1084
|
+
}
|
|
1085
|
+
const prev = i > 0 ? s.charCodeAt(i - 1) : 0;
|
|
1086
|
+
return prev < 0xd800 || prev > 0xdbff
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
/**
|
|
1090
|
+
* Compare two strings by code point. This gives the same order as the UTF-8 bytes of the
|
|
1091
|
+
* strings, and git sorts paths in that order. The `<` operator compares UTF-16 code units,
|
|
1092
|
+
* so it puts a character above U+FFFF (a surrogate pair) before the characters from U+E000
|
|
1093
|
+
* to U+FFFF. Git puts it after them. A lone surrogate counts as U+FFFD, because the UTF-8
|
|
1094
|
+
* encoding of the path writes it that way.
|
|
1095
|
+
*
|
|
1096
|
+
* @param {string} a
|
|
1097
|
+
* @param {string} b
|
|
1098
|
+
* @returns {-1 | 0 | 1}
|
|
1099
|
+
*/
|
|
1074
1100
|
function compareStrings(a, b) {
|
|
1075
|
-
|
|
1076
|
-
|
|
1101
|
+
if (!NEEDS_CODE_POINT_ORDER.test(a) && !NEEDS_CODE_POINT_ORDER.test(b)) {
|
|
1102
|
+
// Both orders are the same, and the `<` operator is the fastest way.
|
|
1103
|
+
return -(a < b) || +(a > b)
|
|
1104
|
+
}
|
|
1105
|
+
const length = Math.min(a.length, b.length);
|
|
1106
|
+
for (let i = 0; i < length; i++) {
|
|
1107
|
+
let x = a.charCodeAt(i);
|
|
1108
|
+
let y = b.charCodeAt(i);
|
|
1109
|
+
if (x !== y) {
|
|
1110
|
+
if (isLoneSurrogate(a, i, x)) x = 0xfffd;
|
|
1111
|
+
if (isLoneSurrogate(b, i, y)) y = 0xfffd;
|
|
1112
|
+
if (x === y) continue
|
|
1113
|
+
// Move the surrogates (U+D800 to U+DFFF) above U+FFFF, where their code points are.
|
|
1114
|
+
if (x >= 0xd800 && y >= 0xd800) {
|
|
1115
|
+
x += x >= 0xe000 ? -0x800 : 0x2000;
|
|
1116
|
+
y += y >= 0xe000 ? -0x800 : 0x2000;
|
|
1117
|
+
}
|
|
1118
|
+
return x < y ? -1 : 1
|
|
1119
|
+
}
|
|
1120
|
+
}
|
|
1121
|
+
return a.length < b.length ? -1 : a.length > b.length ? 1 : 0
|
|
1077
1122
|
}
|
|
1078
1123
|
|
|
1079
1124
|
function comparePath(a, b) {
|
|
@@ -5283,6 +5328,23 @@ class CheckoutConflictError extends BaseError {
|
|
|
5283
5328
|
/** @type {'CheckoutConflictError'} */
|
|
5284
5329
|
CheckoutConflictError.code = 'CheckoutConflictError';
|
|
5285
5330
|
|
|
5331
|
+
class CherryPickLocalChangesError extends BaseError {
|
|
5332
|
+
/**
|
|
5333
|
+
* @param {string[]} filepaths
|
|
5334
|
+
*/
|
|
5335
|
+
constructor(filepaths) {
|
|
5336
|
+
super(
|
|
5337
|
+
`Your local changes to the following files would be overwritten by cherry-pick: ${filepaths.join(
|
|
5338
|
+
', '
|
|
5339
|
+
)}`
|
|
5340
|
+
);
|
|
5341
|
+
this.code = this.name = CherryPickLocalChangesError.code;
|
|
5342
|
+
this.data = { filepaths };
|
|
5343
|
+
}
|
|
5344
|
+
}
|
|
5345
|
+
/** @type {'CherryPickLocalChangesError'} */
|
|
5346
|
+
CherryPickLocalChangesError.code = 'CherryPickLocalChangesError';
|
|
5347
|
+
|
|
5286
5348
|
class CherryPickMergeCommitError extends BaseError {
|
|
5287
5349
|
/**
|
|
5288
5350
|
* @param {string} oid
|
package/managers/index.js
CHANGED
|
@@ -1064,9 +1064,54 @@ class BufferCursor {
|
|
|
1064
1064
|
}
|
|
1065
1065
|
}
|
|
1066
1066
|
|
|
1067
|
+
// Code units from U+D800 up. Only these can make the two orders differ.
|
|
1068
|
+
const NEEDS_CODE_POINT_ORDER = /[\ud800-]/;
|
|
1069
|
+
|
|
1070
|
+
// Is the code unit at index i a surrogate with no partner? Such a unit is not valid Unicode.
|
|
1071
|
+
// A high surrogate needs a low one after it. A low surrogate needs a high one before it.
|
|
1072
|
+
function isLoneSurrogate(s, i, unit) {
|
|
1073
|
+
if (unit < 0xd800 || unit > 0xdfff) return false
|
|
1074
|
+
if (unit < 0xdc00) {
|
|
1075
|
+
const next = i + 1 < s.length ? s.charCodeAt(i + 1) : 0;
|
|
1076
|
+
return next < 0xdc00 || next > 0xdfff
|
|
1077
|
+
}
|
|
1078
|
+
const prev = i > 0 ? s.charCodeAt(i - 1) : 0;
|
|
1079
|
+
return prev < 0xd800 || prev > 0xdbff
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* Compare two strings by code point. This gives the same order as the UTF-8 bytes of the
|
|
1084
|
+
* strings, and git sorts paths in that order. The `<` operator compares UTF-16 code units,
|
|
1085
|
+
* so it puts a character above U+FFFF (a surrogate pair) before the characters from U+E000
|
|
1086
|
+
* to U+FFFF. Git puts it after them. A lone surrogate counts as U+FFFD, because the UTF-8
|
|
1087
|
+
* encoding of the path writes it that way.
|
|
1088
|
+
*
|
|
1089
|
+
* @param {string} a
|
|
1090
|
+
* @param {string} b
|
|
1091
|
+
* @returns {-1 | 0 | 1}
|
|
1092
|
+
*/
|
|
1067
1093
|
function compareStrings(a, b) {
|
|
1068
|
-
|
|
1069
|
-
|
|
1094
|
+
if (!NEEDS_CODE_POINT_ORDER.test(a) && !NEEDS_CODE_POINT_ORDER.test(b)) {
|
|
1095
|
+
// Both orders are the same, and the `<` operator is the fastest way.
|
|
1096
|
+
return -(a < b) || +(a > b)
|
|
1097
|
+
}
|
|
1098
|
+
const length = Math.min(a.length, b.length);
|
|
1099
|
+
for (let i = 0; i < length; i++) {
|
|
1100
|
+
let x = a.charCodeAt(i);
|
|
1101
|
+
let y = b.charCodeAt(i);
|
|
1102
|
+
if (x !== y) {
|
|
1103
|
+
if (isLoneSurrogate(a, i, x)) x = 0xfffd;
|
|
1104
|
+
if (isLoneSurrogate(b, i, y)) y = 0xfffd;
|
|
1105
|
+
if (x === y) continue
|
|
1106
|
+
// Move the surrogates (U+D800 to U+DFFF) above U+FFFF, where their code points are.
|
|
1107
|
+
if (x >= 0xd800 && y >= 0xd800) {
|
|
1108
|
+
x += x >= 0xe000 ? -0x800 : 0x2000;
|
|
1109
|
+
y += y >= 0xe000 ? -0x800 : 0x2000;
|
|
1110
|
+
}
|
|
1111
|
+
return x < y ? -1 : 1
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
return a.length < b.length ? -1 : a.length > b.length ? 1 : 0
|
|
1070
1115
|
}
|
|
1071
1116
|
|
|
1072
1117
|
function comparePath(a, b) {
|
|
@@ -5270,6 +5315,23 @@ class CheckoutConflictError extends BaseError {
|
|
|
5270
5315
|
/** @type {'CheckoutConflictError'} */
|
|
5271
5316
|
CheckoutConflictError.code = 'CheckoutConflictError';
|
|
5272
5317
|
|
|
5318
|
+
class CherryPickLocalChangesError extends BaseError {
|
|
5319
|
+
/**
|
|
5320
|
+
* @param {string[]} filepaths
|
|
5321
|
+
*/
|
|
5322
|
+
constructor(filepaths) {
|
|
5323
|
+
super(
|
|
5324
|
+
`Your local changes to the following files would be overwritten by cherry-pick: ${filepaths.join(
|
|
5325
|
+
', '
|
|
5326
|
+
)}`
|
|
5327
|
+
);
|
|
5328
|
+
this.code = this.name = CherryPickLocalChangesError.code;
|
|
5329
|
+
this.data = { filepaths };
|
|
5330
|
+
}
|
|
5331
|
+
}
|
|
5332
|
+
/** @type {'CherryPickLocalChangesError'} */
|
|
5333
|
+
CherryPickLocalChangesError.code = 'CherryPickLocalChangesError';
|
|
5334
|
+
|
|
5273
5335
|
class CherryPickMergeCommitError extends BaseError {
|
|
5274
5336
|
/**
|
|
5275
5337
|
* @param {string} oid
|