isomorphic-git 1.44.14 → 1.44.16
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/index.cjs +120 -56
- package/index.js +120 -56
- 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 +118 -54
- package/managers/index.js +118 -54
- 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/LICENSE.md
CHANGED
|
@@ -5,3 +5,55 @@ Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
|
5
5
|
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
6
6
|
|
|
7
7
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
8
|
+
|
|
9
|
+
## Third-party code
|
|
10
|
+
|
|
11
|
+
### path-browserify
|
|
12
|
+
|
|
13
|
+
`src/utils/join.js` contains the POSIX path normalisation from
|
|
14
|
+
[path-browserify](https://github.com/browserify/path-browserify), which
|
|
15
|
+
extracted it from Node.js.
|
|
16
|
+
|
|
17
|
+
MIT License
|
|
18
|
+
|
|
19
|
+
Copyright (c) 2013 James Halliday
|
|
20
|
+
|
|
21
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
22
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
23
|
+
the Software without restriction, including without limitation the rights to
|
|
24
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
|
25
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
|
26
|
+
subject to the following conditions:
|
|
27
|
+
|
|
28
|
+
The above copyright notice and this permission notice shall be included in all
|
|
29
|
+
copies or substantial portions of the Software.
|
|
30
|
+
|
|
31
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
32
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
|
33
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
|
34
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
|
35
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
36
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
37
|
+
|
|
38
|
+
The Node.js code it was extracted from carries its own notice:
|
|
39
|
+
|
|
40
|
+
Copyright Joyent, Inc. and other Node contributors.
|
|
41
|
+
|
|
42
|
+
Permission is hereby granted, free of charge, to any person obtaining a
|
|
43
|
+
copy of this software and associated documentation files (the
|
|
44
|
+
"Software"), to deal in the Software without restriction, including
|
|
45
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
46
|
+
distribute, sublicense, and/or sell copies of the Software, and to permit
|
|
47
|
+
persons to whom the Software is furnished to do so, subject to the
|
|
48
|
+
following conditions:
|
|
49
|
+
|
|
50
|
+
The above copyright notice and this permission notice shall be included
|
|
51
|
+
in all copies or substantial portions of the Software.
|
|
52
|
+
|
|
53
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
54
|
+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
55
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
|
|
56
|
+
NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
|
57
|
+
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
|
|
58
|
+
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
|
|
59
|
+
USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/index.cjs
CHANGED
|
@@ -1557,16 +1557,45 @@ class GitPackedRefs {
|
|
|
1557
1557
|
}
|
|
1558
1558
|
|
|
1559
1559
|
class GitRefSpec {
|
|
1560
|
-
constructor({
|
|
1560
|
+
constructor({
|
|
1561
|
+
remotePath,
|
|
1562
|
+
remoteSuffix = '',
|
|
1563
|
+
localPath,
|
|
1564
|
+
force,
|
|
1565
|
+
matchPrefix,
|
|
1566
|
+
negative = false,
|
|
1567
|
+
}) {
|
|
1561
1568
|
Object.assign(this, {
|
|
1562
1569
|
remotePath,
|
|
1570
|
+
remoteSuffix,
|
|
1563
1571
|
localPath,
|
|
1564
1572
|
force,
|
|
1565
1573
|
matchPrefix,
|
|
1574
|
+
negative,
|
|
1566
1575
|
});
|
|
1567
1576
|
}
|
|
1568
1577
|
|
|
1569
1578
|
static from(refspec) {
|
|
1579
|
+
// A negative refspec like `^refs/heads/tmp/*` excludes the refs it matches,
|
|
1580
|
+
// and a refspec without a destination like `refs/heads/main` doesn't store
|
|
1581
|
+
// the ref locally.
|
|
1582
|
+
if (refspec.startsWith('^') || !refspec.includes(':')) {
|
|
1583
|
+
const negative = refspec.startsWith('^');
|
|
1584
|
+
const [, forceMatch, remote] = refspec
|
|
1585
|
+
.slice(negative ? 1 : 0)
|
|
1586
|
+
.match(/^(\+?)(.*)$/);
|
|
1587
|
+
// The `*` of a pattern can be followed by the rest of the name, like
|
|
1588
|
+
// `refs/heads/*-tmp`.
|
|
1589
|
+
const star = remote.indexOf('*');
|
|
1590
|
+
return new GitRefSpec({
|
|
1591
|
+
remotePath: star === -1 ? remote : remote.slice(0, star),
|
|
1592
|
+
remoteSuffix: star === -1 ? '' : remote.slice(star + 1),
|
|
1593
|
+
localPath: null,
|
|
1594
|
+
force: forceMatch === '+',
|
|
1595
|
+
matchPrefix: star !== -1,
|
|
1596
|
+
negative,
|
|
1597
|
+
})
|
|
1598
|
+
}
|
|
1570
1599
|
const [forceMatch, remotePath, remoteGlobMatch, localPath, localGlobMatch] =
|
|
1571
1600
|
refspec.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1);
|
|
1572
1601
|
const force = forceMatch === '+';
|
|
@@ -1586,7 +1615,19 @@ class GitRefSpec {
|
|
|
1586
1615
|
// TODO: We need to run resolveRef on both paths to expand them to their full name.
|
|
1587
1616
|
}
|
|
1588
1617
|
|
|
1618
|
+
matches(remoteBranch) {
|
|
1619
|
+
// Like canonical git, the `*` matches any part of the name, even an empty
|
|
1620
|
+
// one, as long as the prefix and the suffix don't overlap.
|
|
1621
|
+
return this.matchPrefix
|
|
1622
|
+
? remoteBranch.length >=
|
|
1623
|
+
this.remotePath.length + this.remoteSuffix.length &&
|
|
1624
|
+
remoteBranch.startsWith(this.remotePath) &&
|
|
1625
|
+
remoteBranch.endsWith(this.remoteSuffix)
|
|
1626
|
+
: remoteBranch === this.remotePath
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1589
1629
|
translate(remoteBranch) {
|
|
1630
|
+
if (this.localPath === null) return null
|
|
1590
1631
|
if (this.matchPrefix) {
|
|
1591
1632
|
if (remoteBranch.startsWith(this.remotePath)) {
|
|
1592
1633
|
return this.localPath + remoteBranch.replace(this.remotePath, '')
|
|
@@ -1598,6 +1639,7 @@ class GitRefSpec {
|
|
|
1598
1639
|
}
|
|
1599
1640
|
|
|
1600
1641
|
reverseTranslate(localBranch) {
|
|
1642
|
+
if (this.localPath === null) return null
|
|
1601
1643
|
if (this.matchPrefix) {
|
|
1602
1644
|
if (localBranch.startsWith(this.localPath)) {
|
|
1603
1645
|
return this.remotePath + localBranch.replace(this.localPath, '')
|
|
@@ -1627,10 +1669,15 @@ class GitRefSpecSet {
|
|
|
1627
1669
|
this.rules.push(rule);
|
|
1628
1670
|
}
|
|
1629
1671
|
|
|
1672
|
+
isExcluded(remoteRef) {
|
|
1673
|
+
return this.rules.some(rule => rule.negative && rule.matches(remoteRef))
|
|
1674
|
+
}
|
|
1675
|
+
|
|
1630
1676
|
translate(remoteRefs) {
|
|
1631
1677
|
const result = [];
|
|
1632
1678
|
for (const rule of this.rules) {
|
|
1633
1679
|
for (const remoteRef of remoteRefs) {
|
|
1680
|
+
if (this.isExcluded(remoteRef)) continue
|
|
1634
1681
|
const localRef = rule.translate(remoteRef);
|
|
1635
1682
|
if (localRef) {
|
|
1636
1683
|
result.push([remoteRef, localRef]);
|
|
@@ -1642,6 +1689,7 @@ class GitRefSpecSet {
|
|
|
1642
1689
|
|
|
1643
1690
|
translateOne(remoteRef) {
|
|
1644
1691
|
let result = null;
|
|
1692
|
+
if (this.isExcluded(remoteRef)) return result
|
|
1645
1693
|
for (const rule of this.rules) {
|
|
1646
1694
|
const localRef = rule.translate(remoteRef);
|
|
1647
1695
|
if (localRef) {
|
|
@@ -1653,7 +1701,7 @@ class GitRefSpecSet {
|
|
|
1653
1701
|
|
|
1654
1702
|
localNamespaces() {
|
|
1655
1703
|
return this.rules
|
|
1656
|
-
.filter(rule => rule.matchPrefix)
|
|
1704
|
+
.filter(rule => rule.matchPrefix && rule.localPath !== null)
|
|
1657
1705
|
.map(rule => rule.localPath.replace(/\/$/, ''))
|
|
1658
1706
|
}
|
|
1659
1707
|
}
|
|
@@ -1686,57 +1734,75 @@ function isValidRef(name, onelevel) {
|
|
|
1686
1734
|
}
|
|
1687
1735
|
|
|
1688
1736
|
/*!
|
|
1689
|
-
*
|
|
1690
|
-
*
|
|
1691
|
-
*
|
|
1737
|
+
* The POSIX core below - `assertPath`, `normalizeStringPosix` and the body of
|
|
1738
|
+
* `normalize` - comes from path-browserify, which extracted it from Node.js.
|
|
1739
|
+
* Reformatted to this project's style (`const`/`let`, no semicolons); the
|
|
1740
|
+
* algorithm is unchanged.
|
|
1692
1741
|
*
|
|
1693
|
-
*
|
|
1742
|
+
* SPDX-License-Identifier: MIT
|
|
1743
|
+
* Copyright (c) 2013 James Halliday
|
|
1744
|
+
* Copyright Joyent, Inc. and other Node contributors.
|
|
1745
|
+
*
|
|
1746
|
+
* @see https://github.com/browserify/path-browserify
|
|
1747
|
+
*
|
|
1748
|
+
* The Windows handling is this project's own, added in #2302. path-browserify
|
|
1749
|
+
* is the POSIX part of `path` only, so `normalize` and `join` are wrapped with:
|
|
1694
1750
|
* - Backslashes are normalised to forward slashes before processing.
|
|
1695
1751
|
* - Drive-letter prefixes (e.g. "C:") are detected and preserved through
|
|
1696
1752
|
* normalisation, so absolute Windows paths are handled correctly.
|
|
1697
|
-
* -
|
|
1753
|
+
* - A drive-letter argument passed to join() resets the accumulated path,
|
|
1698
1754
|
* matching Node behaviour and handling worktree gitdir paths properly.
|
|
1699
1755
|
*
|
|
1700
1756
|
* Limitation: UNC paths (e.g. \\server\share) are not supported. The leading
|
|
1701
1757
|
* backslashes are normalised to forward slashes and then collapsed by
|
|
1702
|
-
*
|
|
1758
|
+
* normalizeStringPosix, losing the UNC root. Git on Windows works with
|
|
1703
1759
|
* drive-letter paths, so this is not expected to be a practical issue.
|
|
1704
1760
|
*/
|
|
1705
1761
|
|
|
1706
|
-
function
|
|
1762
|
+
function assertPath(path) {
|
|
1763
|
+
if (typeof path !== 'string') {
|
|
1764
|
+
throw new TypeError(
|
|
1765
|
+
'Path must be a string. Received ' + JSON.stringify(path)
|
|
1766
|
+
)
|
|
1767
|
+
}
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
// Resolves . and .. elements in a path with directory names
|
|
1771
|
+
function normalizeStringPosix(path, allowAboveRoot) {
|
|
1707
1772
|
let res = '';
|
|
1708
1773
|
let lastSegmentLength = 0;
|
|
1709
1774
|
let lastSlash = -1;
|
|
1710
1775
|
let dots = 0;
|
|
1711
|
-
let
|
|
1776
|
+
let code;
|
|
1712
1777
|
for (let i = 0; i <= path.length; ++i) {
|
|
1713
|
-
if (i < path.length)
|
|
1714
|
-
else if (
|
|
1715
|
-
else
|
|
1716
|
-
|
|
1717
|
-
if (char === '/') {
|
|
1778
|
+
if (i < path.length) code = path.charCodeAt(i);
|
|
1779
|
+
else if (code === 47 /* / */) break
|
|
1780
|
+
else code = 47; /* / */
|
|
1781
|
+
if (code === 47 /* / */) {
|
|
1718
1782
|
if (lastSlash === i - 1 || dots === 1) {
|
|
1719
1783
|
// NOOP
|
|
1720
|
-
} else if (dots === 2) {
|
|
1784
|
+
} else if (lastSlash !== i - 1 && dots === 2) {
|
|
1721
1785
|
if (
|
|
1722
1786
|
res.length < 2 ||
|
|
1723
1787
|
lastSegmentLength !== 2 ||
|
|
1724
|
-
res.
|
|
1725
|
-
res.
|
|
1788
|
+
res.charCodeAt(res.length - 1) !== 46 /* . */ ||
|
|
1789
|
+
res.charCodeAt(res.length - 2) !== 46 /* . */
|
|
1726
1790
|
) {
|
|
1727
1791
|
if (res.length > 2) {
|
|
1728
1792
|
const lastSlashIndex = res.lastIndexOf('/');
|
|
1729
|
-
if (lastSlashIndex
|
|
1730
|
-
|
|
1731
|
-
|
|
1732
|
-
|
|
1733
|
-
|
|
1734
|
-
|
|
1793
|
+
if (lastSlashIndex !== res.length - 1) {
|
|
1794
|
+
if (lastSlashIndex === -1) {
|
|
1795
|
+
res = '';
|
|
1796
|
+
lastSegmentLength = 0;
|
|
1797
|
+
} else {
|
|
1798
|
+
res = res.slice(0, lastSlashIndex);
|
|
1799
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf('/');
|
|
1800
|
+
}
|
|
1801
|
+
lastSlash = i;
|
|
1802
|
+
dots = 0;
|
|
1803
|
+
continue
|
|
1735
1804
|
}
|
|
1736
|
-
|
|
1737
|
-
dots = 0;
|
|
1738
|
-
continue
|
|
1739
|
-
} else if (res.length !== 0) {
|
|
1805
|
+
} else if (res.length === 2 || res.length === 1) {
|
|
1740
1806
|
res = '';
|
|
1741
1807
|
lastSegmentLength = 0;
|
|
1742
1808
|
lastSlash = i;
|
|
@@ -1744,8 +1810,9 @@ function normalizeString(path, aar) {
|
|
|
1744
1810
|
continue
|
|
1745
1811
|
}
|
|
1746
1812
|
}
|
|
1747
|
-
if (
|
|
1748
|
-
|
|
1813
|
+
if (allowAboveRoot) {
|
|
1814
|
+
if (res.length > 0) res += '/..';
|
|
1815
|
+
else res = '..';
|
|
1749
1816
|
lastSegmentLength = 2;
|
|
1750
1817
|
}
|
|
1751
1818
|
} else {
|
|
@@ -1755,7 +1822,7 @@ function normalizeString(path, aar) {
|
|
|
1755
1822
|
}
|
|
1756
1823
|
lastSlash = i;
|
|
1757
1824
|
dots = 0;
|
|
1758
|
-
} else if (
|
|
1825
|
+
} else if (code === 46 /* . */ && dots !== -1) {
|
|
1759
1826
|
++dots;
|
|
1760
1827
|
} else {
|
|
1761
1828
|
dots = -1;
|
|
@@ -1773,7 +1840,9 @@ function getWindowsDrivePrefix(path) {
|
|
|
1773
1840
|
}
|
|
1774
1841
|
|
|
1775
1842
|
function normalize(path) {
|
|
1776
|
-
|
|
1843
|
+
assertPath(path);
|
|
1844
|
+
|
|
1845
|
+
if (path.length === 0) return '.'
|
|
1777
1846
|
|
|
1778
1847
|
// Normalise backslashes to forward slashes before any other processing.
|
|
1779
1848
|
path = path.replace(/\\/g, '/');
|
|
@@ -1781,26 +1850,19 @@ function normalize(path) {
|
|
|
1781
1850
|
const drivePrefix = getWindowsDrivePrefix(path);
|
|
1782
1851
|
// isAbsolute: Unix root ('/foo') OR Windows drive+slash ('C:/foo').
|
|
1783
1852
|
const isAbsolute =
|
|
1784
|
-
path
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
//
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1853
|
+
path.charCodeAt(0) === 47 /* / */ ||
|
|
1854
|
+
(drivePrefix !== null && path.charCodeAt(2) === 47); /* / */
|
|
1855
|
+
const trailingSeparator = path.charCodeAt(path.length - 1) === 47; /* / */
|
|
1856
|
+
|
|
1857
|
+
// Strip the drive prefix before normalizing so that the core algorithm only
|
|
1858
|
+
// ever sees a plain POSIX-style string.
|
|
1859
|
+
let normalized = normalizeStringPosix(
|
|
1860
|
+
drivePrefix ? path.slice(2) : path,
|
|
1861
|
+
!isAbsolute
|
|
1862
|
+
);
|
|
1792
1863
|
|
|
1793
|
-
if (
|
|
1794
|
-
|
|
1795
|
-
? isAbsolute
|
|
1796
|
-
? drivePrefix + '/'
|
|
1797
|
-
: drivePrefix
|
|
1798
|
-
: isAbsolute
|
|
1799
|
-
? '/'
|
|
1800
|
-
: '.';
|
|
1801
|
-
return trailingSeparator && !isAbsolute ? root + '/' : root
|
|
1802
|
-
}
|
|
1803
|
-
if (trailingSeparator) normalized += '/';
|
|
1864
|
+
if (normalized.length === 0 && !isAbsolute) normalized = '.';
|
|
1865
|
+
if (normalized.length > 0 && trailingSeparator) normalized += '/';
|
|
1804
1866
|
|
|
1805
1867
|
if (drivePrefix) {
|
|
1806
1868
|
return isAbsolute
|
|
@@ -1814,19 +1876,21 @@ function join(...args) {
|
|
|
1814
1876
|
if (args.length === 0) return '.'
|
|
1815
1877
|
let joined;
|
|
1816
1878
|
for (let i = 0; i < args.length; ++i) {
|
|
1879
|
+
assertPath(args[i]);
|
|
1817
1880
|
// Normalise separators before processing.
|
|
1818
1881
|
const arg = args[i].replace(/\\/g, '/');
|
|
1819
1882
|
if (arg.length === 0) continue
|
|
1820
1883
|
|
|
1821
1884
|
// A Windows drive-letter path (e.g. "C:/worktrees/foo") cannot be
|
|
1822
1885
|
// meaningfully appended to any base, so it resets the accumulator.
|
|
1823
|
-
// Unix absolute paths (leading '/') are NOT reset here
|
|
1886
|
+
// Unix absolute paths (leading '/') are NOT reset here - that would be
|
|
1824
1887
|
// path.resolve() semantics; path.join('foo', '/bar') must yield 'foo/bar'.
|
|
1825
1888
|
if (/^[a-zA-Z]:\//.test(arg)) {
|
|
1826
1889
|
joined = arg;
|
|
1890
|
+
} else if (joined === undefined) {
|
|
1891
|
+
joined = arg;
|
|
1827
1892
|
} else {
|
|
1828
|
-
|
|
1829
|
-
else joined += '/' + arg;
|
|
1893
|
+
joined += '/' + arg;
|
|
1830
1894
|
}
|
|
1831
1895
|
}
|
|
1832
1896
|
if (joined === undefined) return '.'
|
|
@@ -10377,8 +10441,8 @@ function filterCapabilities(server, client) {
|
|
|
10377
10441
|
|
|
10378
10442
|
const pkg = {
|
|
10379
10443
|
name: 'isomorphic-git',
|
|
10380
|
-
version: '1.44.
|
|
10381
|
-
agent: 'git/isomorphic-git@1.44.
|
|
10444
|
+
version: '1.44.16',
|
|
10445
|
+
agent: 'git/isomorphic-git@1.44.16',
|
|
10382
10446
|
};
|
|
10383
10447
|
|
|
10384
10448
|
class FIFO {
|