isomorphic-git 1.27.1 → 1.27.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/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import AsyncLock from 'async-lock';
2
2
  import Hash from 'sha.js/sha1.js';
3
+ import { join } from 'path-browserify';
3
4
  import crc32 from 'crc-32';
4
5
  import pako from 'pako';
5
6
  import pify from 'pify';
@@ -1475,40 +1476,6 @@ function compareRefNames(a, b) {
1475
1476
  return tmp
1476
1477
  }
1477
1478
 
1478
- const memo = new Map();
1479
- function normalizePath(path) {
1480
- let normalizedPath = memo.get(path);
1481
- if (!normalizedPath) {
1482
- normalizedPath = normalizePathInternal(path);
1483
- memo.set(path, normalizedPath);
1484
- }
1485
- return normalizedPath
1486
- }
1487
-
1488
- function normalizePathInternal(path) {
1489
- path = path
1490
- .split('/./')
1491
- .join('/') // Replace '/./' with '/'
1492
- .replace(/\/{2,}/g, '/'); // Replace consecutive '/'
1493
-
1494
- if (path === '/.') return '/' // if path === '/.' return '/'
1495
- if (path === './') return '.' // if path === './' return '.'
1496
-
1497
- if (path.startsWith('./')) path = path.slice(2); // Remove leading './'
1498
- if (path.endsWith('/.')) path = path.slice(0, -2); // Remove trailing '/.'
1499
- if (path.length > 1 && path.endsWith('/')) path = path.slice(0, -1); // Remove trailing '/'
1500
-
1501
- if (path === '') return '.' // if path === '' return '.'
1502
-
1503
- return path
1504
- }
1505
-
1506
- // For some reason path.posix.join is undefined in webpack
1507
-
1508
- function join(...parts) {
1509
- return normalizePath(parts.map(normalizePath).join('/'))
1510
- }
1511
-
1512
1479
  // This is straight from parse_unit_factor in config.c of canonical git
1513
1480
  const num = val => {
1514
1481
  val = val.toLowerCase();
@@ -1624,7 +1591,7 @@ const getPath = (section, subsection, name) => {
1624
1591
  .join('.')
1625
1592
  };
1626
1593
 
1627
- const normalizePath$1 = path => {
1594
+ const normalizePath = path => {
1628
1595
  const pathSegments = path.split('.');
1629
1596
  const section = pathSegments.shift();
1630
1597
  const name = pathSegments.pop();
@@ -1680,7 +1647,7 @@ class GitConfig {
1680
1647
  }
1681
1648
 
1682
1649
  async get(path, getall = false) {
1683
- const normalizedPath = normalizePath$1(path).path;
1650
+ const normalizedPath = normalizePath(path).path;
1684
1651
  const allValues = this.parsedConfig
1685
1652
  .filter(config => config.path === normalizedPath)
1686
1653
  .map(({ section, name, value }) => {
@@ -1718,7 +1685,7 @@ class GitConfig {
1718
1685
  name,
1719
1686
  path: normalizedPath,
1720
1687
  sectionPath,
1721
- } = normalizePath$1(path);
1688
+ } = normalizePath(path);
1722
1689
  const configIndex = findLastIndex(
1723
1690
  this.parsedConfig,
1724
1691
  config => config.path === normalizedPath
@@ -4594,7 +4561,11 @@ class FileSystem {
4594
4561
  await this._stat(filepath);
4595
4562
  return true
4596
4563
  } catch (err) {
4597
- if (err.code === 'ENOENT' || err.code === 'ENOTDIR') {
4564
+ if (
4565
+ err.code === 'ENOENT' ||
4566
+ err.code === 'ENOTDIR' ||
4567
+ (err.code || '').includes('ENS')
4568
+ ) {
4598
4569
  return false
4599
4570
  } else {
4600
4571
  console.log('Unhandled error in "FileSystem.exists()" function', err);
@@ -4747,7 +4718,7 @@ class FileSystem {
4747
4718
  const stats = await this._lstat(filename);
4748
4719
  return stats
4749
4720
  } catch (err) {
4750
- if (err.code === 'ENOENT') {
4721
+ if (err.code === 'ENOENT' || (err.code || '').includes('ENS')) {
4751
4722
  return null
4752
4723
  }
4753
4724
  throw err
@@ -4765,7 +4736,7 @@ class FileSystem {
4765
4736
  const link = await this._readlink(filename, opts);
4766
4737
  return Buffer.isBuffer(link) ? link : Buffer.from(link)
4767
4738
  } catch (err) {
4768
- if (err.code === 'ENOENT') {
4739
+ if (err.code === 'ENOENT' || (err.code || '').includes('ENS')) {
4769
4740
  return null
4770
4741
  }
4771
4742
  throw err
@@ -7623,8 +7594,8 @@ function filterCapabilities(server, client) {
7623
7594
 
7624
7595
  const pkg = {
7625
7596
  name: 'isomorphic-git',
7626
- version: '1.27.1',
7627
- agent: 'git/isomorphic-git@1.27.1',
7597
+ version: '1.27.3',
7598
+ agent: 'git/isomorphic-git@1.27.3',
7628
7599
  };
7629
7600
 
7630
7601
  class FIFO {