isomorphic-git 1.44.14 → 1.44.15
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 +52 -4
- package/index.js +52 -4
- package/index.umd.min.js +1 -1
- package/index.umd.min.js.map +1 -1
- package/managers/index.cjs +50 -2
- package/managers/index.js +50 -2
- package/managers/index.umd.min.js +1 -1
- package/managers/index.umd.min.js.map +1 -1
- package/package.json +1 -1
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
|
}
|
|
@@ -10377,8 +10425,8 @@ function filterCapabilities(server, client) {
|
|
|
10377
10425
|
|
|
10378
10426
|
const pkg = {
|
|
10379
10427
|
name: 'isomorphic-git',
|
|
10380
|
-
version: '1.44.
|
|
10381
|
-
agent: 'git/isomorphic-git@1.44.
|
|
10428
|
+
version: '1.44.15',
|
|
10429
|
+
agent: 'git/isomorphic-git@1.44.15',
|
|
10382
10430
|
};
|
|
10383
10431
|
|
|
10384
10432
|
class FIFO {
|
package/index.js
CHANGED
|
@@ -1551,16 +1551,45 @@ class GitPackedRefs {
|
|
|
1551
1551
|
}
|
|
1552
1552
|
|
|
1553
1553
|
class GitRefSpec {
|
|
1554
|
-
constructor({
|
|
1554
|
+
constructor({
|
|
1555
|
+
remotePath,
|
|
1556
|
+
remoteSuffix = '',
|
|
1557
|
+
localPath,
|
|
1558
|
+
force,
|
|
1559
|
+
matchPrefix,
|
|
1560
|
+
negative = false,
|
|
1561
|
+
}) {
|
|
1555
1562
|
Object.assign(this, {
|
|
1556
1563
|
remotePath,
|
|
1564
|
+
remoteSuffix,
|
|
1557
1565
|
localPath,
|
|
1558
1566
|
force,
|
|
1559
1567
|
matchPrefix,
|
|
1568
|
+
negative,
|
|
1560
1569
|
});
|
|
1561
1570
|
}
|
|
1562
1571
|
|
|
1563
1572
|
static from(refspec) {
|
|
1573
|
+
// A negative refspec like `^refs/heads/tmp/*` excludes the refs it matches,
|
|
1574
|
+
// and a refspec without a destination like `refs/heads/main` doesn't store
|
|
1575
|
+
// the ref locally.
|
|
1576
|
+
if (refspec.startsWith('^') || !refspec.includes(':')) {
|
|
1577
|
+
const negative = refspec.startsWith('^');
|
|
1578
|
+
const [, forceMatch, remote] = refspec
|
|
1579
|
+
.slice(negative ? 1 : 0)
|
|
1580
|
+
.match(/^(\+?)(.*)$/);
|
|
1581
|
+
// The `*` of a pattern can be followed by the rest of the name, like
|
|
1582
|
+
// `refs/heads/*-tmp`.
|
|
1583
|
+
const star = remote.indexOf('*');
|
|
1584
|
+
return new GitRefSpec({
|
|
1585
|
+
remotePath: star === -1 ? remote : remote.slice(0, star),
|
|
1586
|
+
remoteSuffix: star === -1 ? '' : remote.slice(star + 1),
|
|
1587
|
+
localPath: null,
|
|
1588
|
+
force: forceMatch === '+',
|
|
1589
|
+
matchPrefix: star !== -1,
|
|
1590
|
+
negative,
|
|
1591
|
+
})
|
|
1592
|
+
}
|
|
1564
1593
|
const [forceMatch, remotePath, remoteGlobMatch, localPath, localGlobMatch] =
|
|
1565
1594
|
refspec.match(/^(\+?)(.*?)(\*?):(.*?)(\*?)$/).slice(1);
|
|
1566
1595
|
const force = forceMatch === '+';
|
|
@@ -1580,7 +1609,19 @@ class GitRefSpec {
|
|
|
1580
1609
|
// TODO: We need to run resolveRef on both paths to expand them to their full name.
|
|
1581
1610
|
}
|
|
1582
1611
|
|
|
1612
|
+
matches(remoteBranch) {
|
|
1613
|
+
// Like canonical git, the `*` matches any part of the name, even an empty
|
|
1614
|
+
// one, as long as the prefix and the suffix don't overlap.
|
|
1615
|
+
return this.matchPrefix
|
|
1616
|
+
? remoteBranch.length >=
|
|
1617
|
+
this.remotePath.length + this.remoteSuffix.length &&
|
|
1618
|
+
remoteBranch.startsWith(this.remotePath) &&
|
|
1619
|
+
remoteBranch.endsWith(this.remoteSuffix)
|
|
1620
|
+
: remoteBranch === this.remotePath
|
|
1621
|
+
}
|
|
1622
|
+
|
|
1583
1623
|
translate(remoteBranch) {
|
|
1624
|
+
if (this.localPath === null) return null
|
|
1584
1625
|
if (this.matchPrefix) {
|
|
1585
1626
|
if (remoteBranch.startsWith(this.remotePath)) {
|
|
1586
1627
|
return this.localPath + remoteBranch.replace(this.remotePath, '')
|
|
@@ -1592,6 +1633,7 @@ class GitRefSpec {
|
|
|
1592
1633
|
}
|
|
1593
1634
|
|
|
1594
1635
|
reverseTranslate(localBranch) {
|
|
1636
|
+
if (this.localPath === null) return null
|
|
1595
1637
|
if (this.matchPrefix) {
|
|
1596
1638
|
if (localBranch.startsWith(this.localPath)) {
|
|
1597
1639
|
return this.remotePath + localBranch.replace(this.localPath, '')
|
|
@@ -1621,10 +1663,15 @@ class GitRefSpecSet {
|
|
|
1621
1663
|
this.rules.push(rule);
|
|
1622
1664
|
}
|
|
1623
1665
|
|
|
1666
|
+
isExcluded(remoteRef) {
|
|
1667
|
+
return this.rules.some(rule => rule.negative && rule.matches(remoteRef))
|
|
1668
|
+
}
|
|
1669
|
+
|
|
1624
1670
|
translate(remoteRefs) {
|
|
1625
1671
|
const result = [];
|
|
1626
1672
|
for (const rule of this.rules) {
|
|
1627
1673
|
for (const remoteRef of remoteRefs) {
|
|
1674
|
+
if (this.isExcluded(remoteRef)) continue
|
|
1628
1675
|
const localRef = rule.translate(remoteRef);
|
|
1629
1676
|
if (localRef) {
|
|
1630
1677
|
result.push([remoteRef, localRef]);
|
|
@@ -1636,6 +1683,7 @@ class GitRefSpecSet {
|
|
|
1636
1683
|
|
|
1637
1684
|
translateOne(remoteRef) {
|
|
1638
1685
|
let result = null;
|
|
1686
|
+
if (this.isExcluded(remoteRef)) return result
|
|
1639
1687
|
for (const rule of this.rules) {
|
|
1640
1688
|
const localRef = rule.translate(remoteRef);
|
|
1641
1689
|
if (localRef) {
|
|
@@ -1647,7 +1695,7 @@ class GitRefSpecSet {
|
|
|
1647
1695
|
|
|
1648
1696
|
localNamespaces() {
|
|
1649
1697
|
return this.rules
|
|
1650
|
-
.filter(rule => rule.matchPrefix)
|
|
1698
|
+
.filter(rule => rule.matchPrefix && rule.localPath !== null)
|
|
1651
1699
|
.map(rule => rule.localPath.replace(/\/$/, ''))
|
|
1652
1700
|
}
|
|
1653
1701
|
}
|
|
@@ -10365,8 +10413,8 @@ function filterCapabilities(server, client) {
|
|
|
10365
10413
|
|
|
10366
10414
|
const pkg = {
|
|
10367
10415
|
name: 'isomorphic-git',
|
|
10368
|
-
version: '1.44.
|
|
10369
|
-
agent: 'git/isomorphic-git@1.44.
|
|
10416
|
+
version: '1.44.15',
|
|
10417
|
+
agent: 'git/isomorphic-git@1.44.15',
|
|
10370
10418
|
};
|
|
10371
10419
|
|
|
10372
10420
|
class FIFO {
|