isomorphic-git 1.17.1 → 1.17.2

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.
@@ -1,9 +1,8 @@
1
1
  [
2
- "X Chrome Mobile 99.0.4844 (Android 0.0.0)",
3
- "HeadlessChrome 0.0.0 (Linux 0.0.0)",
4
- "Firefox 99.0.0 (Ubuntu 0.0.0)",
5
- "Chrome 79.0.3945 (Windows 10 0.0.0)",
6
- "Safari 13.1.0 (Mac OS X 10.15.4)",
7
- "Mobile Safari 13.0.0 (iOS 13.0.0)",
8
- "Chrome Mobile 99.0.4844 (Android 0.0.0)"
2
+ "Chrome Headless 79.0.3945.0 (Linux x86_64)",
3
+ "Firefox 99.0 (Ubuntu 0.0.0)",
4
+ "Safari 13.1 (Mac OS 10.15.4)",
5
+ "Mobile Safari 13.0 (iOS 13.0)",
6
+ "Edge 79.0.309.65 (Windows 10)",
7
+ "Chrome 96.0.4664.104 (Android 10)"
9
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) {
@@ -6924,8 +6946,8 @@ function filterCapabilities(server, client) {
6924
6946
 
6925
6947
  const pkg = {
6926
6948
  name: 'isomorphic-git',
6927
- version: '1.17.1',
6928
- agent: 'git/isomorphic-git@1.17.1',
6949
+ version: '1.17.2',
6950
+ agent: 'git/isomorphic-git@1.17.2',
6929
6951
  };
6930
6952
 
6931
6953
  class FIFO {
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) {
@@ -6918,8 +6940,8 @@ function filterCapabilities(server, client) {
6918
6940
 
6919
6941
  const pkg = {
6920
6942
  name: 'isomorphic-git',
6921
- version: '1.17.1',
6922
- agent: 'git/isomorphic-git@1.17.1',
6943
+ version: '1.17.2',
6944
+ agent: 'git/isomorphic-git@1.17.2',
6923
6945
  };
6924
6946
 
6925
6947
  class FIFO {