isomorphic-git 1.25.8 → 1.25.10

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
@@ -370,6 +370,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
370
370
  <td align="center"><a href="https://github.com/yarikoptic"><img src="https://avatars.githubusercontent.com/u/39889?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Yaroslav Halchenko</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=yarikoptic" title="Documentation">📖</a></td>
371
371
  <td align="center"><a href="https://alex-v.blog/"><img src="https://avatars.githubusercontent.com/u/716334?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Alex Villarreal</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=alexvy86" title="Code">💻</a></td>
372
372
  <td align="center"><a href="https://github.com/amrc-benmorrow"><img src="https://avatars.githubusercontent.com/u/120477944?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Ben Morrow</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=amrc-benmorrow" title="Code">💻</a></td>
373
+ <td align="center"><a href="https://github.com/jayree"><img src="https://avatars.githubusercontent.com/u/14836154?v=4?s=60" width="60px;" alt=""/><br /><sub><b>jayree</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=jayree" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=jayree" title="Tests">⚠️</a></td>
373
374
  </tr>
374
375
  </table>
375
376
 
@@ -1,8 +1,10 @@
1
1
  [
2
2
  "Chrome Headless 79.0.3945.0 (Linux x86_64)",
3
3
  "Firefox 125.0 (Ubuntu 0.0.0)",
4
- "Chrome 123.0.0.0 (Android 10)",
4
+ "X Chrome 123.0.0.0 (Android 10)",
5
5
  "Edge 79.0.309.65 (Windows 10)",
6
+ "Safari 13.1 (Mac OS 10.15.4)",
6
7
  "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
+ "Chrome 123.0.0.0 (Android 10)"
8
10
  ]
package/index.cjs CHANGED
@@ -2431,6 +2431,10 @@ function getIterator(iterable) {
2431
2431
  // inspired by 'gartal' but lighter-weight and more battle-tested.
2432
2432
  class StreamReader {
2433
2433
  constructor(stream) {
2434
+ // TODO: fix usage in bundlers before Buffer dependency is removed #1855
2435
+ if (typeof Buffer === 'undefined') {
2436
+ throw new Error('Missing Buffer dependency')
2437
+ }
2434
2438
  this.stream = getIterator(stream);
2435
2439
  this.buffer = null;
2436
2440
  this.cursor = 0;
@@ -4182,17 +4186,14 @@ class GitWalkerFs {
4182
4186
  entry._content = undefined;
4183
4187
  } else {
4184
4188
  const config = await GitConfigManager.get({ fs, gitdir });
4185
- const autocrlf = (await config.get('core.autocrlf')) || false;
4186
- const content = await fs.read(`${dir}/${entry._fullpath}`, {
4187
- encoding: 'utf8',
4188
- autocrlf,
4189
- });
4189
+ const autocrlf = await config.get('core.autocrlf');
4190
+ const content = await fs.read(`${dir}/${entry._fullpath}`, { autocrlf });
4190
4191
  // workaround for a BrowserFS edge case
4191
4192
  entry._actualSize = content.length;
4192
4193
  if (entry._stat && entry._stat.size === -1) {
4193
4194
  entry._stat.size = entry._actualSize;
4194
4195
  }
4195
- entry._content = new TextEncoder().encode(content);
4196
+ entry._content = new Uint8Array(content);
4196
4197
  }
4197
4198
  }
4198
4199
  return entry._content
@@ -4563,8 +4564,14 @@ class FileSystem {
4563
4564
  async read(filepath, options = {}) {
4564
4565
  try {
4565
4566
  let buffer = await this._readFile(filepath, options);
4566
- if (typeof buffer === 'string' && options.autocrlf) {
4567
- buffer = buffer.replace(/\r\n/g, '\n');
4567
+ if (options.autocrlf === 'true') {
4568
+ try {
4569
+ buffer = new TextDecoder('utf8', { fatal: true }).decode(buffer);
4570
+ buffer = buffer.replace(/\r\n/g, '\n');
4571
+ buffer = new TextEncoder().encode(buffer);
4572
+ } catch (error) {
4573
+ // non utf8 file
4574
+ }
4568
4575
  }
4569
4576
  // Convert plain ArrayBuffers to Buffers
4570
4577
  if (typeof buffer !== 'string') {
@@ -5097,20 +5104,12 @@ async function addToIndex({
5097
5104
  }
5098
5105
  } else {
5099
5106
  const config = await GitConfigManager.get({ fs, gitdir });
5100
- const autocrlf = (await config.get('core.autocrlf')) || false;
5107
+ const autocrlf = await config.get('core.autocrlf');
5101
5108
  const object = stats.isSymbolicLink()
5102
5109
  ? await fs.readlink(join(dir, currentFilepath)).then(posixifyPathBuffer)
5103
- : await fs.read(join(dir, currentFilepath), {
5104
- encoding: 'utf8',
5105
- autocrlf,
5106
- });
5110
+ : await fs.read(join(dir, currentFilepath), { autocrlf });
5107
5111
  if (object === null) throw new NotFoundError(currentFilepath)
5108
- const oid = await _writeObject({
5109
- fs,
5110
- gitdir,
5111
- type: 'blob',
5112
- object: new TextEncoder().encode(object),
5113
- });
5112
+ const oid = await _writeObject({ fs, gitdir, type: 'blob', object });
5114
5113
  index.insert({ filepath: currentFilepath, stats, oid });
5115
5114
  }
5116
5115
  });
@@ -7385,8 +7384,8 @@ function filterCapabilities(server, client) {
7385
7384
 
7386
7385
  const pkg = {
7387
7386
  name: 'isomorphic-git',
7388
- version: '1.25.8',
7389
- agent: 'git/isomorphic-git@1.25.8',
7387
+ version: '1.25.10',
7388
+ agent: 'git/isomorphic-git@1.25.10',
7390
7389
  };
7391
7390
 
7392
7391
  class FIFO {
package/index.js CHANGED
@@ -2425,6 +2425,10 @@ function getIterator(iterable) {
2425
2425
  // inspired by 'gartal' but lighter-weight and more battle-tested.
2426
2426
  class StreamReader {
2427
2427
  constructor(stream) {
2428
+ // TODO: fix usage in bundlers before Buffer dependency is removed #1855
2429
+ if (typeof Buffer === 'undefined') {
2430
+ throw new Error('Missing Buffer dependency')
2431
+ }
2428
2432
  this.stream = getIterator(stream);
2429
2433
  this.buffer = null;
2430
2434
  this.cursor = 0;
@@ -4176,17 +4180,14 @@ class GitWalkerFs {
4176
4180
  entry._content = undefined;
4177
4181
  } else {
4178
4182
  const config = await GitConfigManager.get({ fs, gitdir });
4179
- const autocrlf = (await config.get('core.autocrlf')) || false;
4180
- const content = await fs.read(`${dir}/${entry._fullpath}`, {
4181
- encoding: 'utf8',
4182
- autocrlf,
4183
- });
4183
+ const autocrlf = await config.get('core.autocrlf');
4184
+ const content = await fs.read(`${dir}/${entry._fullpath}`, { autocrlf });
4184
4185
  // workaround for a BrowserFS edge case
4185
4186
  entry._actualSize = content.length;
4186
4187
  if (entry._stat && entry._stat.size === -1) {
4187
4188
  entry._stat.size = entry._actualSize;
4188
4189
  }
4189
- entry._content = new TextEncoder().encode(content);
4190
+ entry._content = new Uint8Array(content);
4190
4191
  }
4191
4192
  }
4192
4193
  return entry._content
@@ -4557,8 +4558,14 @@ class FileSystem {
4557
4558
  async read(filepath, options = {}) {
4558
4559
  try {
4559
4560
  let buffer = await this._readFile(filepath, options);
4560
- if (typeof buffer === 'string' && options.autocrlf) {
4561
- buffer = buffer.replace(/\r\n/g, '\n');
4561
+ if (options.autocrlf === 'true') {
4562
+ try {
4563
+ buffer = new TextDecoder('utf8', { fatal: true }).decode(buffer);
4564
+ buffer = buffer.replace(/\r\n/g, '\n');
4565
+ buffer = new TextEncoder().encode(buffer);
4566
+ } catch (error) {
4567
+ // non utf8 file
4568
+ }
4562
4569
  }
4563
4570
  // Convert plain ArrayBuffers to Buffers
4564
4571
  if (typeof buffer !== 'string') {
@@ -5091,20 +5098,12 @@ async function addToIndex({
5091
5098
  }
5092
5099
  } else {
5093
5100
  const config = await GitConfigManager.get({ fs, gitdir });
5094
- const autocrlf = (await config.get('core.autocrlf')) || false;
5101
+ const autocrlf = await config.get('core.autocrlf');
5095
5102
  const object = stats.isSymbolicLink()
5096
5103
  ? await fs.readlink(join(dir, currentFilepath)).then(posixifyPathBuffer)
5097
- : await fs.read(join(dir, currentFilepath), {
5098
- encoding: 'utf8',
5099
- autocrlf,
5100
- });
5104
+ : await fs.read(join(dir, currentFilepath), { autocrlf });
5101
5105
  if (object === null) throw new NotFoundError(currentFilepath)
5102
- const oid = await _writeObject({
5103
- fs,
5104
- gitdir,
5105
- type: 'blob',
5106
- object: new TextEncoder().encode(object),
5107
- });
5106
+ const oid = await _writeObject({ fs, gitdir, type: 'blob', object });
5108
5107
  index.insert({ filepath: currentFilepath, stats, oid });
5109
5108
  }
5110
5109
  });
@@ -7379,8 +7378,8 @@ function filterCapabilities(server, client) {
7379
7378
 
7380
7379
  const pkg = {
7381
7380
  name: 'isomorphic-git',
7382
- version: '1.25.8',
7383
- agent: 'git/isomorphic-git@1.25.8',
7381
+ version: '1.25.10',
7382
+ agent: 'git/isomorphic-git@1.25.10',
7384
7383
  };
7385
7384
 
7386
7385
  class FIFO {