isomorphic-git 1.25.1 → 1.25.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
@@ -365,6 +365,8 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
365
365
  </tr>
366
366
  <tr>
367
367
  <td align="center"><a href="https://github.com/DanilKazanov"><img src="https://avatars.githubusercontent.com/u/139755256?v=4?s=60" width="60px;" alt=""/><br /><sub><b>DanilKazanov</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=DanilKazanov" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=DanilKazanov" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=DanilKazanov" title="Tests">⚠️</a></td>
368
+ <td align="center"><a href="https://api.github.com/users/hisco"><img src="https://avatars.githubusercontent.com/u/39222286?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Eyal Hisco</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/issues?q=author%3Ahisco" title="Bug reports">🐛</a></td>
369
+ <td align="center"><a href="https://github.com/scolladon"><img src="https://avatars.githubusercontent.com/u/522422?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Sebastien</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=scolladon" title="Code">💻</a></td>
368
370
  </tr>
369
371
  </table>
370
372
 
@@ -1,11 +1,12 @@
1
1
  [
2
2
  "Chrome Headless 79.0.3945.0 (Linux x86_64)",
3
- "X Firefox 120.0 (Ubuntu 0.0.0)",
4
- "Chrome 117.0.0.0 (Android 10)",
3
+ "Firefox 121.0 (Ubuntu 0.0.0)",
4
+ "X Chrome 117.0.0.0 (Android 10)",
5
5
  "Edge 79.0.309.65 (Windows 10)",
6
- "Safari 13.1 (Mac OS 10.15.4)",
7
6
  "Mobile Safari 13.0 (iOS 13.0)",
7
+ "Safari 13.1 (Mac OS 10.15.4)",
8
+ "Chrome Headless 79.0.3945.0 (Linux x86_64)",
9
+ "X Chrome 117.0.0.0 (Android 10)",
8
10
  "Chrome Headless 79.0.3945.0 (Linux x86_64)",
9
- "Firefox 120.0 (Ubuntu 0.0.0)",
10
11
  "Chrome 117.0.0.0 (Android 10)"
11
12
  ]
package/index.cjs CHANGED
@@ -1448,16 +1448,32 @@ function compareRefNames(a, b) {
1448
1448
  return tmp
1449
1449
  }
1450
1450
 
1451
+ const memo = new Map();
1451
1452
  function normalizePath(path) {
1453
+ let normalizedPath = memo.get(path);
1454
+ if (!normalizedPath) {
1455
+ normalizedPath = normalizePathInternal(path);
1456
+ memo.set(path, normalizedPath);
1457
+ }
1458
+ return normalizedPath
1459
+ }
1460
+
1461
+ function normalizePathInternal(path) {
1462
+ path = path
1463
+ .split('/./')
1464
+ .join('/') // Replace '/./' with '/'
1465
+ .replace(/\/{2,}/g, '/'); // Replace consecutive '/'
1466
+
1467
+ if (path === '/.') return '/' // if path === '/.' return '/'
1468
+ if (path === './') return '.' // if path === './' return '.'
1469
+
1470
+ if (path.startsWith('./')) path = path.slice(2); // Remove leading './'
1471
+ if (path.endsWith('/.')) path = path.slice(0, -2); // Remove trailing '/.'
1472
+ if (path.length > 1 && path.endsWith('/')) path = path.slice(0, -1); // Remove trailing '/'
1473
+
1474
+ if (path === '') return '.' // if path === '' return '.'
1475
+
1452
1476
  return path
1453
- .replace(/\/\.\//g, '/') // Replace '/./' with '/'
1454
- .replace(/\/{2,}/g, '/') // Replace consecutive '/'
1455
- .replace(/^\/\.$/, '/') // if path === '/.' return '/'
1456
- .replace(/^\.\/$/, '.') // if path === './' return '.'
1457
- .replace(/^\.\//, '') // Remove leading './'
1458
- .replace(/\/\.$/, '') // Remove trailing '/.'
1459
- .replace(/(.+)\/$/, '$1') // Remove trailing '/'
1460
- .replace(/^$/, '.') // if path === '' return '.'
1461
1477
  }
1462
1478
 
1463
1479
  // For some reason path.posix.join is undefined in webpack
@@ -2457,6 +2473,7 @@ class StreamReader {
2457
2473
  let { done, value } = await this.stream.next();
2458
2474
  if (done) {
2459
2475
  this._ended = true;
2476
+ if (!value) return Buffer.alloc(0)
2460
2477
  }
2461
2478
  if (value) {
2462
2479
  value = Buffer.from(value);
@@ -6839,7 +6856,7 @@ class GitPktLine {
6839
6856
  if (buffer == null) return true
6840
6857
  return buffer
6841
6858
  } catch (err) {
6842
- console.log('error', err);
6859
+ stream.error = err;
6843
6860
  return true
6844
6861
  }
6845
6862
  }
@@ -7316,8 +7333,8 @@ function filterCapabilities(server, client) {
7316
7333
 
7317
7334
  const pkg = {
7318
7335
  name: 'isomorphic-git',
7319
- version: '1.25.1',
7320
- agent: 'git/isomorphic-git@1.25.1',
7336
+ version: '1.25.3',
7337
+ agent: 'git/isomorphic-git@1.25.3',
7321
7338
  };
7322
7339
 
7323
7340
  class FIFO {
@@ -7348,8 +7365,8 @@ class FIFO {
7348
7365
  }
7349
7366
 
7350
7367
  destroy(err) {
7351
- this._ended = true;
7352
7368
  this.error = err;
7369
+ this.end();
7353
7370
  }
7354
7371
 
7355
7372
  async next() {
@@ -7444,7 +7461,7 @@ class GitSideBand {
7444
7461
  if (line === true) {
7445
7462
  packetlines.end();
7446
7463
  progress.end();
7447
- packfile.end();
7464
+ input.error ? packfile.destroy(input.error) : packfile.end();
7448
7465
  return
7449
7466
  }
7450
7467
  // Examine first byte to determine which output "stream" to use
@@ -7463,12 +7480,14 @@ class GitSideBand {
7463
7480
  // fatal error message just before stream aborts
7464
7481
  const error = line.slice(1);
7465
7482
  progress.write(error);
7483
+ packetlines.end();
7484
+ progress.end();
7466
7485
  packfile.destroy(new Error(error.toString('utf8')));
7467
7486
  return
7468
7487
  }
7469
7488
  default: {
7470
7489
  // Not part of the side-band-64k protocol
7471
- packetlines.write(line.slice(0));
7490
+ packetlines.write(line);
7472
7491
  }
7473
7492
  }
7474
7493
  // Careful not to blow up the stack.
@@ -7586,7 +7605,15 @@ async function parseUploadPackResponse(stream) {
7586
7605
  nak = true;
7587
7606
  }
7588
7607
  if (done) {
7589
- resolve({ shallows, unshallows, acks, nak, packfile, progress });
7608
+ stream.error
7609
+ ? reject(stream.error)
7610
+ : resolve({ shallows, unshallows, acks, nak, packfile, progress });
7611
+ }
7612
+ }).finally(() => {
7613
+ if (!done) {
7614
+ stream.error
7615
+ ? reject(stream.error)
7616
+ : resolve({ shallows, unshallows, acks, nak, packfile, progress });
7590
7617
  }
7591
7618
  });
7592
7619
  })
@@ -7952,6 +7979,7 @@ async function _fetch({
7952
7979
  });
7953
7980
  }
7954
7981
  const packfile = Buffer.from(await collect(response.packfile));
7982
+ if (raw.body.error) throw raw.body.error
7955
7983
  const packfileSha = packfile.slice(-20).toString('hex');
7956
7984
  const res = {
7957
7985
  defaultBranch: response.HEAD,
package/index.js CHANGED
@@ -1442,16 +1442,32 @@ function compareRefNames(a, b) {
1442
1442
  return tmp
1443
1443
  }
1444
1444
 
1445
+ const memo = new Map();
1445
1446
  function normalizePath(path) {
1447
+ let normalizedPath = memo.get(path);
1448
+ if (!normalizedPath) {
1449
+ normalizedPath = normalizePathInternal(path);
1450
+ memo.set(path, normalizedPath);
1451
+ }
1452
+ return normalizedPath
1453
+ }
1454
+
1455
+ function normalizePathInternal(path) {
1456
+ path = path
1457
+ .split('/./')
1458
+ .join('/') // Replace '/./' with '/'
1459
+ .replace(/\/{2,}/g, '/'); // Replace consecutive '/'
1460
+
1461
+ if (path === '/.') return '/' // if path === '/.' return '/'
1462
+ if (path === './') return '.' // if path === './' return '.'
1463
+
1464
+ if (path.startsWith('./')) path = path.slice(2); // Remove leading './'
1465
+ if (path.endsWith('/.')) path = path.slice(0, -2); // Remove trailing '/.'
1466
+ if (path.length > 1 && path.endsWith('/')) path = path.slice(0, -1); // Remove trailing '/'
1467
+
1468
+ if (path === '') return '.' // if path === '' return '.'
1469
+
1446
1470
  return path
1447
- .replace(/\/\.\//g, '/') // Replace '/./' with '/'
1448
- .replace(/\/{2,}/g, '/') // Replace consecutive '/'
1449
- .replace(/^\/\.$/, '/') // if path === '/.' return '/'
1450
- .replace(/^\.\/$/, '.') // if path === './' return '.'
1451
- .replace(/^\.\//, '') // Remove leading './'
1452
- .replace(/\/\.$/, '') // Remove trailing '/.'
1453
- .replace(/(.+)\/$/, '$1') // Remove trailing '/'
1454
- .replace(/^$/, '.') // if path === '' return '.'
1455
1471
  }
1456
1472
 
1457
1473
  // For some reason path.posix.join is undefined in webpack
@@ -2451,6 +2467,7 @@ class StreamReader {
2451
2467
  let { done, value } = await this.stream.next();
2452
2468
  if (done) {
2453
2469
  this._ended = true;
2470
+ if (!value) return Buffer.alloc(0)
2454
2471
  }
2455
2472
  if (value) {
2456
2473
  value = Buffer.from(value);
@@ -6833,7 +6850,7 @@ class GitPktLine {
6833
6850
  if (buffer == null) return true
6834
6851
  return buffer
6835
6852
  } catch (err) {
6836
- console.log('error', err);
6853
+ stream.error = err;
6837
6854
  return true
6838
6855
  }
6839
6856
  }
@@ -7310,8 +7327,8 @@ function filterCapabilities(server, client) {
7310
7327
 
7311
7328
  const pkg = {
7312
7329
  name: 'isomorphic-git',
7313
- version: '1.25.1',
7314
- agent: 'git/isomorphic-git@1.25.1',
7330
+ version: '1.25.3',
7331
+ agent: 'git/isomorphic-git@1.25.3',
7315
7332
  };
7316
7333
 
7317
7334
  class FIFO {
@@ -7342,8 +7359,8 @@ class FIFO {
7342
7359
  }
7343
7360
 
7344
7361
  destroy(err) {
7345
- this._ended = true;
7346
7362
  this.error = err;
7363
+ this.end();
7347
7364
  }
7348
7365
 
7349
7366
  async next() {
@@ -7438,7 +7455,7 @@ class GitSideBand {
7438
7455
  if (line === true) {
7439
7456
  packetlines.end();
7440
7457
  progress.end();
7441
- packfile.end();
7458
+ input.error ? packfile.destroy(input.error) : packfile.end();
7442
7459
  return
7443
7460
  }
7444
7461
  // Examine first byte to determine which output "stream" to use
@@ -7457,12 +7474,14 @@ class GitSideBand {
7457
7474
  // fatal error message just before stream aborts
7458
7475
  const error = line.slice(1);
7459
7476
  progress.write(error);
7477
+ packetlines.end();
7478
+ progress.end();
7460
7479
  packfile.destroy(new Error(error.toString('utf8')));
7461
7480
  return
7462
7481
  }
7463
7482
  default: {
7464
7483
  // Not part of the side-band-64k protocol
7465
- packetlines.write(line.slice(0));
7484
+ packetlines.write(line);
7466
7485
  }
7467
7486
  }
7468
7487
  // Careful not to blow up the stack.
@@ -7580,7 +7599,15 @@ async function parseUploadPackResponse(stream) {
7580
7599
  nak = true;
7581
7600
  }
7582
7601
  if (done) {
7583
- resolve({ shallows, unshallows, acks, nak, packfile, progress });
7602
+ stream.error
7603
+ ? reject(stream.error)
7604
+ : resolve({ shallows, unshallows, acks, nak, packfile, progress });
7605
+ }
7606
+ }).finally(() => {
7607
+ if (!done) {
7608
+ stream.error
7609
+ ? reject(stream.error)
7610
+ : resolve({ shallows, unshallows, acks, nak, packfile, progress });
7584
7611
  }
7585
7612
  });
7586
7613
  })
@@ -7946,6 +7973,7 @@ async function _fetch({
7946
7973
  });
7947
7974
  }
7948
7975
  const packfile = Buffer.from(await collect(response.packfile));
7976
+ if (raw.body.error) throw raw.body.error
7949
7977
  const packfileSha = packfile.slice(-20).toString('hex');
7950
7978
  const res = {
7951
7979
  defaultBranch: response.HEAD,