isomorphic-git 1.17.0 → 1.17.3

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/README.md CHANGED
@@ -343,6 +343,9 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
343
343
  <td align="center"><a href="http://vitorluizc.github.io/"><img src="https://avatars.githubusercontent.com/u/9027363?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Vitor Luiz Cavalcanti</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=VitorLuizC" title="Documentation">📖</a></td>
344
344
  <td align="center"><a href="https://www.platformdemos.com/"><img src="https://avatars.githubusercontent.com/u/4261788?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Shane McLaughlin</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=mshanemc" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=mshanemc" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=mshanemc" title="Tests">⚠️</a></td>
345
345
  </tr>
346
+ <tr>
347
+ <td align="center"><a href="https://github.com/seanpoulter"><img src="https://avatars.githubusercontent.com/u/2585460?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Sean Poulter</b></sub></a><br /><a href="#maintenance-seanpoulter" title="Maintenance">🚧</a></td>
348
+ </tr>
346
349
  </table>
347
350
 
348
351
  <!-- markdownlint-restore -->
@@ -1,8 +1,8 @@
1
1
  [
2
- "HeadlessChrome 0.0.0 (Linux 0.0.0)",
3
- "Firefox 98.0.0 (Ubuntu 0.0.0)",
4
- "Chrome Mobile 96.0.4664 (Android 0.0.0)",
5
- "Safari 13.1.0 (Mac OS X 10.15.4)",
6
- "Mobile Safari 13.0.0 (iOS 13.0.0)",
7
- "Chrome 79.0.3945 (Windows 10 0.0.0)"
2
+ "Chrome Headless 79.0.3945.0 (Linux x86_64)",
3
+ "Firefox 100.0 (Ubuntu 0.0.0)",
4
+ "Chrome 100.0.4896.127 (Android 10)",
5
+ "Edge 79.0.309.65 (Windows 10)",
6
+ "Safari 13.1 (Mac OS 10.15.4)",
7
+ "Mobile Safari 13.0 (iOS 13.0)"
8
8
  ]
package/index.cjs CHANGED
@@ -1474,6 +1474,21 @@ const getPath = (section, subsection, name) => {
1474
1474
  .join('.')
1475
1475
  };
1476
1476
 
1477
+ const normalizePath$1 = path => {
1478
+ const pathSegments = path.split('.');
1479
+ const section = pathSegments.shift();
1480
+ const name = pathSegments.pop();
1481
+ const subsection = pathSegments.length ? pathSegments.join('.') : undefined;
1482
+
1483
+ return {
1484
+ section,
1485
+ subsection,
1486
+ name,
1487
+ path: getPath(section, subsection, name),
1488
+ sectionPath: getPath(section, subsection, null),
1489
+ }
1490
+ };
1491
+
1477
1492
  const findLastIndex = (array, callback) => {
1478
1493
  return array.reduce((lastIndex, item, index) => {
1479
1494
  return callback(item) ? index : lastIndex
@@ -1513,8 +1528,9 @@ class GitConfig {
1513
1528
  }
1514
1529
 
1515
1530
  async get(path, getall = false) {
1531
+ const normalizedPath = normalizePath$1(path).path;
1516
1532
  const allValues = this.parsedConfig
1517
- .filter(config => config.path === path.toLowerCase())
1533
+ .filter(config => config.path === normalizedPath)
1518
1534
  .map(({ section, name, value }) => {
1519
1535
  const fn = schema[section] && schema[section][name];
1520
1536
  return fn ? fn(value) : value
@@ -1544,9 +1560,16 @@ class GitConfig {
1544
1560
  }
1545
1561
 
1546
1562
  async set(path, value, append = false) {
1563
+ const {
1564
+ section,
1565
+ subsection,
1566
+ name,
1567
+ path: normalizedPath,
1568
+ sectionPath,
1569
+ } = normalizePath$1(path);
1547
1570
  const configIndex = findLastIndex(
1548
1571
  this.parsedConfig,
1549
- config => config.path === path.toLowerCase()
1572
+ config => config.path === normalizedPath
1550
1573
  );
1551
1574
  if (value == null) {
1552
1575
  if (configIndex !== -1) {
@@ -1555,7 +1578,9 @@ class GitConfig {
1555
1578
  } else {
1556
1579
  if (configIndex !== -1) {
1557
1580
  const config = this.parsedConfig[configIndex];
1581
+ // Name should be overwritten in case the casing changed
1558
1582
  const modifiedConfig = Object.assign({}, config, {
1583
+ name,
1559
1584
  value,
1560
1585
  modified: true,
1561
1586
  });
@@ -1565,13 +1590,6 @@ class GitConfig {
1565
1590
  this.parsedConfig[configIndex] = modifiedConfig;
1566
1591
  }
1567
1592
  } else {
1568
- const pathSegments = path.split('.');
1569
- const section = pathSegments.shift().toLowerCase();
1570
- const name = pathSegments.pop();
1571
- const subsection = pathSegments.length
1572
- ? pathSegments.join('.').toLowerCase()
1573
- : undefined;
1574
- const sectionPath = subsection ? section + '.' + subsection : section;
1575
1593
  const sectionIndex = this.parsedConfig.findIndex(
1576
1594
  config => config.path === sectionPath
1577
1595
  );
@@ -1581,7 +1599,7 @@ class GitConfig {
1581
1599
  name,
1582
1600
  value,
1583
1601
  modified: true,
1584
- path: getPath(section, subsection, name),
1602
+ path: normalizedPath,
1585
1603
  };
1586
1604
  if (SECTION_REGEX.test(section) && VARIABLE_NAME_REGEX.test(name)) {
1587
1605
  if (sectionIndex >= 0) {
@@ -1593,7 +1611,7 @@ class GitConfig {
1593
1611
  section,
1594
1612
  subsection,
1595
1613
  modified: true,
1596
- path: getPath(section, subsection, null),
1614
+ path: sectionPath,
1597
1615
  };
1598
1616
  this.parsedConfig.push(newSection, newConfig);
1599
1617
  }
@@ -1609,6 +1627,10 @@ class GitConfig {
1609
1627
  return line
1610
1628
  }
1611
1629
  if (name != null && value != null) {
1630
+ if (typeof value === 'string' && /[#;]/.test(value)) {
1631
+ // A `#` or `;` symbol denotes a comment, so we have to wrap it in double quotes
1632
+ return `\t${name} = "${value}"`
1633
+ }
1612
1634
  return `\t${name} = ${value}`
1613
1635
  }
1614
1636
  if (subsection != null) {
@@ -4470,7 +4492,7 @@ async function add({
4470
4492
  assertParameter('fs', _fs);
4471
4493
  assertParameter('dir', dir);
4472
4494
  assertParameter('gitdir', gitdir);
4473
- assertParameter('filepaths', filepath);
4495
+ assertParameter('filepath', filepath);
4474
4496
 
4475
4497
  const fs = new FileSystem(_fs);
4476
4498
  await GitIndexManager.acquire({ fs, gitdir, cache }, async index => {
@@ -6924,8 +6946,8 @@ function filterCapabilities(server, client) {
6924
6946
 
6925
6947
  const pkg = {
6926
6948
  name: 'isomorphic-git',
6927
- version: '1.17.0',
6928
- agent: 'git/isomorphic-git@1.17.0',
6949
+ version: '1.17.3',
6950
+ agent: 'git/isomorphic-git@1.17.3',
6929
6951
  };
6930
6952
 
6931
6953
  class FIFO {
@@ -10765,11 +10787,11 @@ async function _log({
10765
10787
  }
10766
10788
  }
10767
10789
  if (!found) {
10768
- if (!force && !follow) throw e
10769
10790
  if (isOk && lastFileOid) {
10770
10791
  commits.push(lastCommit);
10771
- // break
10792
+ if (!force) break
10772
10793
  }
10794
+ if (!force && !follow) throw e
10773
10795
  }
10774
10796
  lastCommit = commit;
10775
10797
  isOk = false;
package/index.js CHANGED
@@ -1468,6 +1468,21 @@ const getPath = (section, subsection, name) => {
1468
1468
  .join('.')
1469
1469
  };
1470
1470
 
1471
+ const normalizePath$1 = path => {
1472
+ const pathSegments = path.split('.');
1473
+ const section = pathSegments.shift();
1474
+ const name = pathSegments.pop();
1475
+ const subsection = pathSegments.length ? pathSegments.join('.') : undefined;
1476
+
1477
+ return {
1478
+ section,
1479
+ subsection,
1480
+ name,
1481
+ path: getPath(section, subsection, name),
1482
+ sectionPath: getPath(section, subsection, null),
1483
+ }
1484
+ };
1485
+
1471
1486
  const findLastIndex = (array, callback) => {
1472
1487
  return array.reduce((lastIndex, item, index) => {
1473
1488
  return callback(item) ? index : lastIndex
@@ -1507,8 +1522,9 @@ class GitConfig {
1507
1522
  }
1508
1523
 
1509
1524
  async get(path, getall = false) {
1525
+ const normalizedPath = normalizePath$1(path).path;
1510
1526
  const allValues = this.parsedConfig
1511
- .filter(config => config.path === path.toLowerCase())
1527
+ .filter(config => config.path === normalizedPath)
1512
1528
  .map(({ section, name, value }) => {
1513
1529
  const fn = schema[section] && schema[section][name];
1514
1530
  return fn ? fn(value) : value
@@ -1538,9 +1554,16 @@ class GitConfig {
1538
1554
  }
1539
1555
 
1540
1556
  async set(path, value, append = false) {
1557
+ const {
1558
+ section,
1559
+ subsection,
1560
+ name,
1561
+ path: normalizedPath,
1562
+ sectionPath,
1563
+ } = normalizePath$1(path);
1541
1564
  const configIndex = findLastIndex(
1542
1565
  this.parsedConfig,
1543
- config => config.path === path.toLowerCase()
1566
+ config => config.path === normalizedPath
1544
1567
  );
1545
1568
  if (value == null) {
1546
1569
  if (configIndex !== -1) {
@@ -1549,7 +1572,9 @@ class GitConfig {
1549
1572
  } else {
1550
1573
  if (configIndex !== -1) {
1551
1574
  const config = this.parsedConfig[configIndex];
1575
+ // Name should be overwritten in case the casing changed
1552
1576
  const modifiedConfig = Object.assign({}, config, {
1577
+ name,
1553
1578
  value,
1554
1579
  modified: true,
1555
1580
  });
@@ -1559,13 +1584,6 @@ class GitConfig {
1559
1584
  this.parsedConfig[configIndex] = modifiedConfig;
1560
1585
  }
1561
1586
  } else {
1562
- const pathSegments = path.split('.');
1563
- const section = pathSegments.shift().toLowerCase();
1564
- const name = pathSegments.pop();
1565
- const subsection = pathSegments.length
1566
- ? pathSegments.join('.').toLowerCase()
1567
- : undefined;
1568
- const sectionPath = subsection ? section + '.' + subsection : section;
1569
1587
  const sectionIndex = this.parsedConfig.findIndex(
1570
1588
  config => config.path === sectionPath
1571
1589
  );
@@ -1575,7 +1593,7 @@ class GitConfig {
1575
1593
  name,
1576
1594
  value,
1577
1595
  modified: true,
1578
- path: getPath(section, subsection, name),
1596
+ path: normalizedPath,
1579
1597
  };
1580
1598
  if (SECTION_REGEX.test(section) && VARIABLE_NAME_REGEX.test(name)) {
1581
1599
  if (sectionIndex >= 0) {
@@ -1587,7 +1605,7 @@ class GitConfig {
1587
1605
  section,
1588
1606
  subsection,
1589
1607
  modified: true,
1590
- path: getPath(section, subsection, null),
1608
+ path: sectionPath,
1591
1609
  };
1592
1610
  this.parsedConfig.push(newSection, newConfig);
1593
1611
  }
@@ -1603,6 +1621,10 @@ class GitConfig {
1603
1621
  return line
1604
1622
  }
1605
1623
  if (name != null && value != null) {
1624
+ if (typeof value === 'string' && /[#;]/.test(value)) {
1625
+ // A `#` or `;` symbol denotes a comment, so we have to wrap it in double quotes
1626
+ return `\t${name} = "${value}"`
1627
+ }
1606
1628
  return `\t${name} = ${value}`
1607
1629
  }
1608
1630
  if (subsection != null) {
@@ -4464,7 +4486,7 @@ async function add({
4464
4486
  assertParameter('fs', _fs);
4465
4487
  assertParameter('dir', dir);
4466
4488
  assertParameter('gitdir', gitdir);
4467
- assertParameter('filepaths', filepath);
4489
+ assertParameter('filepath', filepath);
4468
4490
 
4469
4491
  const fs = new FileSystem(_fs);
4470
4492
  await GitIndexManager.acquire({ fs, gitdir, cache }, async index => {
@@ -6918,8 +6940,8 @@ function filterCapabilities(server, client) {
6918
6940
 
6919
6941
  const pkg = {
6920
6942
  name: 'isomorphic-git',
6921
- version: '1.17.0',
6922
- agent: 'git/isomorphic-git@1.17.0',
6943
+ version: '1.17.3',
6944
+ agent: 'git/isomorphic-git@1.17.3',
6923
6945
  };
6924
6946
 
6925
6947
  class FIFO {
@@ -10759,11 +10781,11 @@ async function _log({
10759
10781
  }
10760
10782
  }
10761
10783
  if (!found) {
10762
- if (!force && !follow) throw e
10763
10784
  if (isOk && lastFileOid) {
10764
10785
  commits.push(lastCommit);
10765
- // break
10786
+ if (!force) break
10766
10787
  }
10788
+ if (!force && !follow) throw e
10767
10789
  }
10768
10790
  lastCommit = commit;
10769
10791
  isOk = false;