isomorphic-git 1.44.9 → 1.44.10
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 +30 -16
- package/index.js +30 -16
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/managers/index.cjs +28 -14
- package/managers/index.js +28 -14
- package/managers/index.umd.min.js +1 -1
- package/managers/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/managers/index.cjs
CHANGED
|
@@ -3811,20 +3811,34 @@ class GitCommit {
|
|
|
3811
3811
|
const obj = {
|
|
3812
3812
|
parent: [],
|
|
3813
3813
|
};
|
|
3814
|
-
const
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
|
|
3822
|
-
|
|
3823
|
-
|
|
3824
|
-
|
|
3825
|
-
|
|
3826
|
-
|
|
3827
|
-
|
|
3814
|
+
const keyOf = h => h.slice(0, h.indexOf(' '));
|
|
3815
|
+
const valueOf = h => h.slice(h.indexOf(' ') + 1);
|
|
3816
|
+
// Git reads the start of a commit by position: one `tree`, then the
|
|
3817
|
+
// `parent` lines that follow it directly. Anything after that run is an
|
|
3818
|
+
// extra header that git keeps but never interprets, so a `tree` or
|
|
3819
|
+
// `parent` further down must not count here either. Reading them would
|
|
3820
|
+
// give the same oid a different tree, or a different ancestry, than git
|
|
3821
|
+
// and every other implementation reports.
|
|
3822
|
+
if (hs.length === 0 || keyOf(hs[0]) !== 'tree') {
|
|
3823
|
+
throw new ParseError(
|
|
3824
|
+
'tree as the first commit header',
|
|
3825
|
+
keyOf(hs[0] || '')
|
|
3826
|
+
)
|
|
3827
|
+
}
|
|
3828
|
+
obj.tree = valueOf(hs[0]);
|
|
3829
|
+
let index = 1;
|
|
3830
|
+
while (index < hs.length && keyOf(hs[index]) === 'parent') {
|
|
3831
|
+
obj.parent.push(valueOf(hs[index]));
|
|
3832
|
+
index++;
|
|
3833
|
+
}
|
|
3834
|
+
const seen = new Set(['tree', 'parent']);
|
|
3835
|
+
for (; index < hs.length; index++) {
|
|
3836
|
+
const key = keyOf(hs[index]);
|
|
3837
|
+
// The first occurrence of a single-valued header wins, the way canonical
|
|
3838
|
+
// git reads them.
|
|
3839
|
+
if (seen.has(key)) continue
|
|
3840
|
+
seen.add(key);
|
|
3841
|
+
obj[key] = valueOf(hs[index]);
|
|
3828
3842
|
}
|
|
3829
3843
|
if (obj.author) {
|
|
3830
3844
|
obj.author = parseAuthor(obj.author);
|
package/managers/index.js
CHANGED
|
@@ -3804,20 +3804,34 @@ class GitCommit {
|
|
|
3804
3804
|
const obj = {
|
|
3805
3805
|
parent: [],
|
|
3806
3806
|
};
|
|
3807
|
-
const
|
|
3808
|
-
|
|
3809
|
-
|
|
3810
|
-
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
|
|
3814
|
-
|
|
3815
|
-
|
|
3816
|
-
|
|
3817
|
-
|
|
3818
|
-
|
|
3819
|
-
|
|
3820
|
-
|
|
3807
|
+
const keyOf = h => h.slice(0, h.indexOf(' '));
|
|
3808
|
+
const valueOf = h => h.slice(h.indexOf(' ') + 1);
|
|
3809
|
+
// Git reads the start of a commit by position: one `tree`, then the
|
|
3810
|
+
// `parent` lines that follow it directly. Anything after that run is an
|
|
3811
|
+
// extra header that git keeps but never interprets, so a `tree` or
|
|
3812
|
+
// `parent` further down must not count here either. Reading them would
|
|
3813
|
+
// give the same oid a different tree, or a different ancestry, than git
|
|
3814
|
+
// and every other implementation reports.
|
|
3815
|
+
if (hs.length === 0 || keyOf(hs[0]) !== 'tree') {
|
|
3816
|
+
throw new ParseError(
|
|
3817
|
+
'tree as the first commit header',
|
|
3818
|
+
keyOf(hs[0] || '')
|
|
3819
|
+
)
|
|
3820
|
+
}
|
|
3821
|
+
obj.tree = valueOf(hs[0]);
|
|
3822
|
+
let index = 1;
|
|
3823
|
+
while (index < hs.length && keyOf(hs[index]) === 'parent') {
|
|
3824
|
+
obj.parent.push(valueOf(hs[index]));
|
|
3825
|
+
index++;
|
|
3826
|
+
}
|
|
3827
|
+
const seen = new Set(['tree', 'parent']);
|
|
3828
|
+
for (; index < hs.length; index++) {
|
|
3829
|
+
const key = keyOf(hs[index]);
|
|
3830
|
+
// The first occurrence of a single-valued header wins, the way canonical
|
|
3831
|
+
// git reads them.
|
|
3832
|
+
if (seen.has(key)) continue
|
|
3833
|
+
seen.add(key);
|
|
3834
|
+
obj[key] = valueOf(hs[index]);
|
|
3821
3835
|
}
|
|
3822
3836
|
if (obj.author) {
|
|
3823
3837
|
obj.author = parseAuthor(obj.author);
|