isomorphic-git 1.42.3 → 1.42.5
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/index.cjs +54 -6
- package/index.js +54 -6
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/managers/index.cjs +52 -4
- package/managers/index.js +52 -4
- 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/index.cjs
CHANGED
|
@@ -507,9 +507,54 @@ class BufferCursor {
|
|
|
507
507
|
}
|
|
508
508
|
}
|
|
509
509
|
|
|
510
|
+
// Code units from U+D800 up. Only these can make the two orders differ.
|
|
511
|
+
const NEEDS_CODE_POINT_ORDER = /[\ud800-]/;
|
|
512
|
+
|
|
513
|
+
// Is the code unit at index i a surrogate with no partner? Such a unit is not valid Unicode.
|
|
514
|
+
// A high surrogate needs a low one after it. A low surrogate needs a high one before it.
|
|
515
|
+
function isLoneSurrogate(s, i, unit) {
|
|
516
|
+
if (unit < 0xd800 || unit > 0xdfff) return false
|
|
517
|
+
if (unit < 0xdc00) {
|
|
518
|
+
const next = i + 1 < s.length ? s.charCodeAt(i + 1) : 0;
|
|
519
|
+
return next < 0xdc00 || next > 0xdfff
|
|
520
|
+
}
|
|
521
|
+
const prev = i > 0 ? s.charCodeAt(i - 1) : 0;
|
|
522
|
+
return prev < 0xd800 || prev > 0xdbff
|
|
523
|
+
}
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Compare two strings by code point. This gives the same order as the UTF-8 bytes of the
|
|
527
|
+
* strings, and git sorts paths in that order. The `<` operator compares UTF-16 code units,
|
|
528
|
+
* so it puts a character above U+FFFF (a surrogate pair) before the characters from U+E000
|
|
529
|
+
* to U+FFFF. Git puts it after them. A lone surrogate counts as U+FFFD, because the UTF-8
|
|
530
|
+
* encoding of the path writes it that way.
|
|
531
|
+
*
|
|
532
|
+
* @param {string} a
|
|
533
|
+
* @param {string} b
|
|
534
|
+
* @returns {-1 | 0 | 1}
|
|
535
|
+
*/
|
|
510
536
|
function compareStrings(a, b) {
|
|
511
|
-
|
|
512
|
-
|
|
537
|
+
if (!NEEDS_CODE_POINT_ORDER.test(a) && !NEEDS_CODE_POINT_ORDER.test(b)) {
|
|
538
|
+
// Both orders are the same, and the `<` operator is the fastest way.
|
|
539
|
+
return -(a < b) || +(a > b)
|
|
540
|
+
}
|
|
541
|
+
const length = Math.min(a.length, b.length);
|
|
542
|
+
for (let i = 0; i < length; i++) {
|
|
543
|
+
let x = a.charCodeAt(i);
|
|
544
|
+
let y = b.charCodeAt(i);
|
|
545
|
+
if (x !== y) {
|
|
546
|
+
if (isLoneSurrogate(a, i, x)) x = 0xfffd;
|
|
547
|
+
if (isLoneSurrogate(b, i, y)) y = 0xfffd;
|
|
548
|
+
if (x === y) continue
|
|
549
|
+
// Move the surrogates (U+D800 to U+DFFF) above U+FFFF, where their code points are.
|
|
550
|
+
if (x >= 0xd800 && y >= 0xd800) {
|
|
551
|
+
x += x >= 0xe000 ? -0x800 : 0x2000;
|
|
552
|
+
y += y >= 0xe000 ? -0x800 : 0x2000;
|
|
553
|
+
}
|
|
554
|
+
return x < y ? -1 : 1
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
return a.length < b.length ? -1 : a.length > b.length ? 1 : 0
|
|
513
558
|
}
|
|
514
559
|
|
|
515
560
|
function comparePath(a, b) {
|
|
@@ -5755,14 +5800,17 @@ class GitIgnoreManager {
|
|
|
5755
5800
|
});
|
|
5756
5801
|
}
|
|
5757
5802
|
let ignoredStatus = false;
|
|
5758
|
-
for (const p of pairs) {
|
|
5803
|
+
for (const [index, p] of pairs.entries()) {
|
|
5759
5804
|
let file;
|
|
5760
5805
|
try {
|
|
5761
5806
|
file = await fs.read(p.gitignore, 'utf8');
|
|
5762
5807
|
} catch (err) {
|
|
5763
5808
|
if (err.code === 'NOENT') continue
|
|
5764
5809
|
}
|
|
5765
|
-
const ign = ignore()
|
|
5810
|
+
const ign = ignore();
|
|
5811
|
+
// The patterns in .git/info/exclude are relative to the working directory,
|
|
5812
|
+
// so only the first pair, which holds the full filepath, can use them.
|
|
5813
|
+
if (index === 0) ign.add(excludes);
|
|
5766
5814
|
ign.add(file);
|
|
5767
5815
|
// If the parent directory is excluded, we are done.
|
|
5768
5816
|
// "It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined."
|
|
@@ -9803,8 +9851,8 @@ function filterCapabilities(server, client) {
|
|
|
9803
9851
|
|
|
9804
9852
|
const pkg = {
|
|
9805
9853
|
name: 'isomorphic-git',
|
|
9806
|
-
version: '1.42.
|
|
9807
|
-
agent: 'git/isomorphic-git@1.42.
|
|
9854
|
+
version: '1.42.5',
|
|
9855
|
+
agent: 'git/isomorphic-git@1.42.5',
|
|
9808
9856
|
};
|
|
9809
9857
|
|
|
9810
9858
|
class FIFO {
|
package/index.js
CHANGED
|
@@ -500,9 +500,54 @@ class BufferCursor {
|
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
502
|
|
|
503
|
+
// Code units from U+D800 up. Only these can make the two orders differ.
|
|
504
|
+
const NEEDS_CODE_POINT_ORDER = /[\ud800-]/;
|
|
505
|
+
|
|
506
|
+
// Is the code unit at index i a surrogate with no partner? Such a unit is not valid Unicode.
|
|
507
|
+
// A high surrogate needs a low one after it. A low surrogate needs a high one before it.
|
|
508
|
+
function isLoneSurrogate(s, i, unit) {
|
|
509
|
+
if (unit < 0xd800 || unit > 0xdfff) return false
|
|
510
|
+
if (unit < 0xdc00) {
|
|
511
|
+
const next = i + 1 < s.length ? s.charCodeAt(i + 1) : 0;
|
|
512
|
+
return next < 0xdc00 || next > 0xdfff
|
|
513
|
+
}
|
|
514
|
+
const prev = i > 0 ? s.charCodeAt(i - 1) : 0;
|
|
515
|
+
return prev < 0xd800 || prev > 0xdbff
|
|
516
|
+
}
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* Compare two strings by code point. This gives the same order as the UTF-8 bytes of the
|
|
520
|
+
* strings, and git sorts paths in that order. The `<` operator compares UTF-16 code units,
|
|
521
|
+
* so it puts a character above U+FFFF (a surrogate pair) before the characters from U+E000
|
|
522
|
+
* to U+FFFF. Git puts it after them. A lone surrogate counts as U+FFFD, because the UTF-8
|
|
523
|
+
* encoding of the path writes it that way.
|
|
524
|
+
*
|
|
525
|
+
* @param {string} a
|
|
526
|
+
* @param {string} b
|
|
527
|
+
* @returns {-1 | 0 | 1}
|
|
528
|
+
*/
|
|
503
529
|
function compareStrings(a, b) {
|
|
504
|
-
|
|
505
|
-
|
|
530
|
+
if (!NEEDS_CODE_POINT_ORDER.test(a) && !NEEDS_CODE_POINT_ORDER.test(b)) {
|
|
531
|
+
// Both orders are the same, and the `<` operator is the fastest way.
|
|
532
|
+
return -(a < b) || +(a > b)
|
|
533
|
+
}
|
|
534
|
+
const length = Math.min(a.length, b.length);
|
|
535
|
+
for (let i = 0; i < length; i++) {
|
|
536
|
+
let x = a.charCodeAt(i);
|
|
537
|
+
let y = b.charCodeAt(i);
|
|
538
|
+
if (x !== y) {
|
|
539
|
+
if (isLoneSurrogate(a, i, x)) x = 0xfffd;
|
|
540
|
+
if (isLoneSurrogate(b, i, y)) y = 0xfffd;
|
|
541
|
+
if (x === y) continue
|
|
542
|
+
// Move the surrogates (U+D800 to U+DFFF) above U+FFFF, where their code points are.
|
|
543
|
+
if (x >= 0xd800 && y >= 0xd800) {
|
|
544
|
+
x += x >= 0xe000 ? -0x800 : 0x2000;
|
|
545
|
+
y += y >= 0xe000 ? -0x800 : 0x2000;
|
|
546
|
+
}
|
|
547
|
+
return x < y ? -1 : 1
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
return a.length < b.length ? -1 : a.length > b.length ? 1 : 0
|
|
506
551
|
}
|
|
507
552
|
|
|
508
553
|
function comparePath(a, b) {
|
|
@@ -5742,14 +5787,17 @@ class GitIgnoreManager {
|
|
|
5742
5787
|
});
|
|
5743
5788
|
}
|
|
5744
5789
|
let ignoredStatus = false;
|
|
5745
|
-
for (const p of pairs) {
|
|
5790
|
+
for (const [index, p] of pairs.entries()) {
|
|
5746
5791
|
let file;
|
|
5747
5792
|
try {
|
|
5748
5793
|
file = await fs.read(p.gitignore, 'utf8');
|
|
5749
5794
|
} catch (err) {
|
|
5750
5795
|
if (err.code === 'NOENT') continue
|
|
5751
5796
|
}
|
|
5752
|
-
const ign = ignore()
|
|
5797
|
+
const ign = ignore();
|
|
5798
|
+
// The patterns in .git/info/exclude are relative to the working directory,
|
|
5799
|
+
// so only the first pair, which holds the full filepath, can use them.
|
|
5800
|
+
if (index === 0) ign.add(excludes);
|
|
5753
5801
|
ign.add(file);
|
|
5754
5802
|
// If the parent directory is excluded, we are done.
|
|
5755
5803
|
// "It is not possible to re-include a file if a parent directory of that file is excluded. Git doesn’t list excluded directories for performance reasons, so any patterns on contained files have no effect, no matter where they are defined."
|
|
@@ -9790,8 +9838,8 @@ function filterCapabilities(server, client) {
|
|
|
9790
9838
|
|
|
9791
9839
|
const pkg = {
|
|
9792
9840
|
name: 'isomorphic-git',
|
|
9793
|
-
version: '1.42.
|
|
9794
|
-
agent: 'git/isomorphic-git@1.42.
|
|
9841
|
+
version: '1.42.5',
|
|
9842
|
+
agent: 'git/isomorphic-git@1.42.5',
|
|
9795
9843
|
};
|
|
9796
9844
|
|
|
9797
9845
|
class FIFO {
|