isomorphic-git 1.44.15 → 1.44.17
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/LICENSE.md +52 -0
- package/http/node/index.cjs +102 -26
- package/http/node/index.d.cts +8 -0
- package/http/node/index.d.ts +8 -0
- package/http/node/index.js +102 -26
- package/index.cjs +70 -54
- package/index.js +70 -54
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.LICENSE.txt +20 -12
- package/index.umd.min.js.map +1 -1
- package/managers/index.cjs +68 -52
- package/managers/index.js +68 -52
- package/managers/index.umd.min.js +1 -1
- package/managers/index.umd.min.js.LICENSE.txt +20 -12
- package/managers/index.umd.min.js.map +1 -1
- package/models/index.cjs +69 -53
- package/models/index.js +69 -53
- package/models/index.umd.min.js +1 -1
- package/models/index.umd.min.js.LICENSE.txt +14 -6
- package/models/index.umd.min.js.map +1 -1
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1728,57 +1728,75 @@ function isValidRef(name, onelevel) {
|
|
|
1728
1728
|
}
|
|
1729
1729
|
|
|
1730
1730
|
/*!
|
|
1731
|
-
*
|
|
1732
|
-
*
|
|
1733
|
-
*
|
|
1731
|
+
* The POSIX core below - `assertPath`, `normalizeStringPosix` and the body of
|
|
1732
|
+
* `normalize` - comes from path-browserify, which extracted it from Node.js.
|
|
1733
|
+
* Reformatted to this project's style (`const`/`let`, no semicolons); the
|
|
1734
|
+
* algorithm is unchanged.
|
|
1734
1735
|
*
|
|
1735
|
-
*
|
|
1736
|
+
* SPDX-License-Identifier: MIT
|
|
1737
|
+
* Copyright (c) 2013 James Halliday
|
|
1738
|
+
* Copyright Joyent, Inc. and other Node contributors.
|
|
1739
|
+
*
|
|
1740
|
+
* @see https://github.com/browserify/path-browserify
|
|
1741
|
+
*
|
|
1742
|
+
* The Windows handling is this project's own, added in #2302. path-browserify
|
|
1743
|
+
* is the POSIX part of `path` only, so `normalize` and `join` are wrapped with:
|
|
1736
1744
|
* - Backslashes are normalised to forward slashes before processing.
|
|
1737
1745
|
* - Drive-letter prefixes (e.g. "C:") are detected and preserved through
|
|
1738
1746
|
* normalisation, so absolute Windows paths are handled correctly.
|
|
1739
|
-
* -
|
|
1747
|
+
* - A drive-letter argument passed to join() resets the accumulated path,
|
|
1740
1748
|
* matching Node behaviour and handling worktree gitdir paths properly.
|
|
1741
1749
|
*
|
|
1742
1750
|
* Limitation: UNC paths (e.g. \\server\share) are not supported. The leading
|
|
1743
1751
|
* backslashes are normalised to forward slashes and then collapsed by
|
|
1744
|
-
*
|
|
1752
|
+
* normalizeStringPosix, losing the UNC root. Git on Windows works with
|
|
1745
1753
|
* drive-letter paths, so this is not expected to be a practical issue.
|
|
1746
1754
|
*/
|
|
1747
1755
|
|
|
1748
|
-
function
|
|
1756
|
+
function assertPath(path) {
|
|
1757
|
+
if (typeof path !== 'string') {
|
|
1758
|
+
throw new TypeError(
|
|
1759
|
+
'Path must be a string. Received ' + JSON.stringify(path)
|
|
1760
|
+
)
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
|
|
1764
|
+
// Resolves . and .. elements in a path with directory names
|
|
1765
|
+
function normalizeStringPosix(path, allowAboveRoot) {
|
|
1749
1766
|
let res = '';
|
|
1750
1767
|
let lastSegmentLength = 0;
|
|
1751
1768
|
let lastSlash = -1;
|
|
1752
1769
|
let dots = 0;
|
|
1753
|
-
let
|
|
1770
|
+
let code;
|
|
1754
1771
|
for (let i = 0; i <= path.length; ++i) {
|
|
1755
|
-
if (i < path.length)
|
|
1756
|
-
else if (
|
|
1757
|
-
else
|
|
1758
|
-
|
|
1759
|
-
if (char === '/') {
|
|
1772
|
+
if (i < path.length) code = path.charCodeAt(i);
|
|
1773
|
+
else if (code === 47 /* / */) break
|
|
1774
|
+
else code = 47; /* / */
|
|
1775
|
+
if (code === 47 /* / */) {
|
|
1760
1776
|
if (lastSlash === i - 1 || dots === 1) {
|
|
1761
1777
|
// NOOP
|
|
1762
|
-
} else if (dots === 2) {
|
|
1778
|
+
} else if (lastSlash !== i - 1 && dots === 2) {
|
|
1763
1779
|
if (
|
|
1764
1780
|
res.length < 2 ||
|
|
1765
1781
|
lastSegmentLength !== 2 ||
|
|
1766
|
-
res.
|
|
1767
|
-
res.
|
|
1782
|
+
res.charCodeAt(res.length - 1) !== 46 /* . */ ||
|
|
1783
|
+
res.charCodeAt(res.length - 2) !== 46 /* . */
|
|
1768
1784
|
) {
|
|
1769
1785
|
if (res.length > 2) {
|
|
1770
1786
|
const lastSlashIndex = res.lastIndexOf('/');
|
|
1771
|
-
if (lastSlashIndex
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1787
|
+
if (lastSlashIndex !== res.length - 1) {
|
|
1788
|
+
if (lastSlashIndex === -1) {
|
|
1789
|
+
res = '';
|
|
1790
|
+
lastSegmentLength = 0;
|
|
1791
|
+
} else {
|
|
1792
|
+
res = res.slice(0, lastSlashIndex);
|
|
1793
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
|
|
1794
|
+
}
|
|
1795
|
+
lastSlash = i;
|
|
1796
|
+
dots = 0;
|
|
1797
|
+
continue
|
|
1777
1798
|
}
|
|
1778
|
-
|
|
1779
|
-
dots = 0;
|
|
1780
|
-
continue
|
|
1781
|
-
} else if (res.length !== 0) {
|
|
1799
|
+
} else if (res.length === 2 || res.length === 1) {
|
|
1782
1800
|
res = '';
|
|
1783
1801
|
lastSegmentLength = 0;
|
|
1784
1802
|
lastSlash = i;
|
|
@@ -1786,8 +1804,9 @@ function normalizeString(path, aar) {
|
|
|
1786
1804
|
continue
|
|
1787
1805
|
}
|
|
1788
1806
|
}
|
|
1789
|
-
if (
|
|
1790
|
-
|
|
1807
|
+
if (allowAboveRoot) {
|
|
1808
|
+
if (res.length > 0) res += '/..';
|
|
1809
|
+
else res = '..';
|
|
1791
1810
|
lastSegmentLength = 2;
|
|
1792
1811
|
}
|
|
1793
1812
|
} else {
|
|
@@ -1797,7 +1816,7 @@ function normalizeString(path, aar) {
|
|
|
1797
1816
|
}
|
|
1798
1817
|
lastSlash = i;
|
|
1799
1818
|
dots = 0;
|
|
1800
|
-
} else if (
|
|
1819
|
+
} else if (code === 46 /* . */ && dots !== -1) {
|
|
1801
1820
|
++dots;
|
|
1802
1821
|
} else {
|
|
1803
1822
|
dots = -1;
|
|
@@ -1815,7 +1834,9 @@ function getWindowsDrivePrefix(path) {
|
|
|
1815
1834
|
}
|
|
1816
1835
|
|
|
1817
1836
|
function normalize(path) {
|
|
1818
|
-
|
|
1837
|
+
assertPath(path);
|
|
1838
|
+
|
|
1839
|
+
if (path.length === 0) return '.'
|
|
1819
1840
|
|
|
1820
1841
|
// Normalise backslashes to forward slashes before any other processing.
|
|
1821
1842
|
path = path.replace(/\\/g, '/');
|
|
@@ -1823,26 +1844,19 @@ function normalize(path) {
|
|
|
1823
1844
|
const drivePrefix = getWindowsDrivePrefix(path);
|
|
1824
1845
|
// isAbsolute: Unix root ('/foo') OR Windows drive+slash ('C:/foo').
|
|
1825
1846
|
const isAbsolute =
|
|
1826
|
-
path
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
//
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1847
|
+
path.charCodeAt(0) === 47 /* / */ ||
|
|
1848
|
+
(drivePrefix !== null && path.charCodeAt(2) === 47); /* / */
|
|
1849
|
+
const trailingSeparator = path.charCodeAt(path.length - 1) === 47; /* / */
|
|
1850
|
+
|
|
1851
|
+
// Strip the drive prefix before normalizing so that the core algorithm only
|
|
1852
|
+
// ever sees a plain POSIX-style string.
|
|
1853
|
+
let normalized = normalizeStringPosix(
|
|
1854
|
+
drivePrefix ? path.slice(2) : path,
|
|
1855
|
+
!isAbsolute
|
|
1856
|
+
);
|
|
1834
1857
|
|
|
1835
|
-
if (
|
|
1836
|
-
|
|
1837
|
-
? isAbsolute
|
|
1838
|
-
? drivePrefix + '/'
|
|
1839
|
-
: drivePrefix
|
|
1840
|
-
: isAbsolute
|
|
1841
|
-
? '/'
|
|
1842
|
-
: '.';
|
|
1843
|
-
return trailingSeparator && !isAbsolute ? root + '/' : root
|
|
1844
|
-
}
|
|
1845
|
-
if (trailingSeparator) normalized += '/';
|
|
1858
|
+
if (normalized.length === 0 && !isAbsolute) normalized = '.';
|
|
1859
|
+
if (normalized.length > 0 && trailingSeparator) normalized += '/';
|
|
1846
1860
|
|
|
1847
1861
|
if (drivePrefix) {
|
|
1848
1862
|
return isAbsolute
|
|
@@ -1856,19 +1870,21 @@ function join(...args) {
|
|
|
1856
1870
|
if (args.length === 0) return '.'
|
|
1857
1871
|
let joined;
|
|
1858
1872
|
for (let i = 0; i < args.length; ++i) {
|
|
1873
|
+
assertPath(args[i]);
|
|
1859
1874
|
// Normalise separators before processing.
|
|
1860
1875
|
const arg = args[i].replace(/\\/g, '/');
|
|
1861
1876
|
if (arg.length === 0) continue
|
|
1862
1877
|
|
|
1863
1878
|
// A Windows drive-letter path (e.g. "C:/worktrees/foo") cannot be
|
|
1864
1879
|
// meaningfully appended to any base, so it resets the accumulator.
|
|
1865
|
-
// Unix absolute paths (leading '/') are NOT reset here
|
|
1880
|
+
// Unix absolute paths (leading '/') are NOT reset here - that would be
|
|
1866
1881
|
// path.resolve() semantics; path.join('foo', '/bar') must yield 'foo/bar'.
|
|
1867
1882
|
if (/^[a-zA-Z]:\//.test(arg)) {
|
|
1868
1883
|
joined = arg;
|
|
1884
|
+
} else if (joined === undefined) {
|
|
1885
|
+
joined = arg;
|
|
1869
1886
|
} else {
|
|
1870
|
-
|
|
1871
|
-
else joined += '/' + arg;
|
|
1887
|
+
joined += '/' + arg;
|
|
1872
1888
|
}
|
|
1873
1889
|
}
|
|
1874
1890
|
if (joined === undefined) return '.'
|
|
@@ -10413,8 +10429,8 @@ function filterCapabilities(server, client) {
|
|
|
10413
10429
|
|
|
10414
10430
|
const pkg = {
|
|
10415
10431
|
name: 'isomorphic-git',
|
|
10416
|
-
version: '1.44.
|
|
10417
|
-
agent: 'git/isomorphic-git@1.44.
|
|
10432
|
+
version: '1.44.17',
|
|
10433
|
+
agent: 'git/isomorphic-git@1.44.17',
|
|
10418
10434
|
};
|
|
10419
10435
|
|
|
10420
10436
|
class FIFO {
|