isomorphic-git 1.25.8 → 1.25.9

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
 
@@ -3,6 +3,6 @@
3
3
  "Firefox 125.0 (Ubuntu 0.0.0)",
4
4
  "Chrome 123.0.0.0 (Android 10)",
5
5
  "Edge 79.0.309.65 (Windows 10)",
6
- "Mobile Safari 13.0 (iOS 13.0)",
7
- "Safari 13.1 (Mac OS 10.15.4)"
6
+ "Safari 13.1 (Mac OS 10.15.4)",
7
+ "Mobile Safari 13.0 (iOS 13.0)"
8
8
  ]
package/index.cjs CHANGED
@@ -4182,17 +4182,14 @@ class GitWalkerFs {
4182
4182
  entry._content = undefined;
4183
4183
  } else {
4184
4184
  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
- });
4185
+ const autocrlf = await config.get('core.autocrlf');
4186
+ const content = await fs.read(`${dir}/${entry._fullpath}`, { autocrlf });
4190
4187
  // workaround for a BrowserFS edge case
4191
4188
  entry._actualSize = content.length;
4192
4189
  if (entry._stat && entry._stat.size === -1) {
4193
4190
  entry._stat.size = entry._actualSize;
4194
4191
  }
4195
- entry._content = new TextEncoder().encode(content);
4192
+ entry._content = new Uint8Array(content);
4196
4193
  }
4197
4194
  }
4198
4195
  return entry._content
@@ -4563,8 +4560,14 @@ class FileSystem {
4563
4560
  async read(filepath, options = {}) {
4564
4561
  try {
4565
4562
  let buffer = await this._readFile(filepath, options);
4566
- if (typeof buffer === 'string' && options.autocrlf) {
4567
- buffer = buffer.replace(/\r\n/g, '\n');
4563
+ if (options.autocrlf === 'true') {
4564
+ try {
4565
+ buffer = new TextDecoder('utf8', { fatal: true }).decode(buffer);
4566
+ buffer = buffer.replace(/\r\n/g, '\n');
4567
+ buffer = new TextEncoder().encode(buffer);
4568
+ } catch (error) {
4569
+ // non utf8 file
4570
+ }
4568
4571
  }
4569
4572
  // Convert plain ArrayBuffers to Buffers
4570
4573
  if (typeof buffer !== 'string') {
@@ -5097,20 +5100,12 @@ async function addToIndex({
5097
5100
  }
5098
5101
  } else {
5099
5102
  const config = await GitConfigManager.get({ fs, gitdir });
5100
- const autocrlf = (await config.get('core.autocrlf')) || false;
5103
+ const autocrlf = await config.get('core.autocrlf');
5101
5104
  const object = stats.isSymbolicLink()
5102
5105
  ? await fs.readlink(join(dir, currentFilepath)).then(posixifyPathBuffer)
5103
- : await fs.read(join(dir, currentFilepath), {
5104
- encoding: 'utf8',
5105
- autocrlf,
5106
- });
5106
+ : await fs.read(join(dir, currentFilepath), { autocrlf });
5107
5107
  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
- });
5108
+ const oid = await _writeObject({ fs, gitdir, type: 'blob', object });
5114
5109
  index.insert({ filepath: currentFilepath, stats, oid });
5115
5110
  }
5116
5111
  });
@@ -7385,8 +7380,8 @@ function filterCapabilities(server, client) {
7385
7380
 
7386
7381
  const pkg = {
7387
7382
  name: 'isomorphic-git',
7388
- version: '1.25.8',
7389
- agent: 'git/isomorphic-git@1.25.8',
7383
+ version: '1.25.9',
7384
+ agent: 'git/isomorphic-git@1.25.9',
7390
7385
  };
7391
7386
 
7392
7387
  class FIFO {
package/index.js CHANGED
@@ -4176,17 +4176,14 @@ class GitWalkerFs {
4176
4176
  entry._content = undefined;
4177
4177
  } else {
4178
4178
  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
- });
4179
+ const autocrlf = await config.get('core.autocrlf');
4180
+ const content = await fs.read(`${dir}/${entry._fullpath}`, { autocrlf });
4184
4181
  // workaround for a BrowserFS edge case
4185
4182
  entry._actualSize = content.length;
4186
4183
  if (entry._stat && entry._stat.size === -1) {
4187
4184
  entry._stat.size = entry._actualSize;
4188
4185
  }
4189
- entry._content = new TextEncoder().encode(content);
4186
+ entry._content = new Uint8Array(content);
4190
4187
  }
4191
4188
  }
4192
4189
  return entry._content
@@ -4557,8 +4554,14 @@ class FileSystem {
4557
4554
  async read(filepath, options = {}) {
4558
4555
  try {
4559
4556
  let buffer = await this._readFile(filepath, options);
4560
- if (typeof buffer === 'string' && options.autocrlf) {
4561
- buffer = buffer.replace(/\r\n/g, '\n');
4557
+ if (options.autocrlf === 'true') {
4558
+ try {
4559
+ buffer = new TextDecoder('utf8', { fatal: true }).decode(buffer);
4560
+ buffer = buffer.replace(/\r\n/g, '\n');
4561
+ buffer = new TextEncoder().encode(buffer);
4562
+ } catch (error) {
4563
+ // non utf8 file
4564
+ }
4562
4565
  }
4563
4566
  // Convert plain ArrayBuffers to Buffers
4564
4567
  if (typeof buffer !== 'string') {
@@ -5091,20 +5094,12 @@ async function addToIndex({
5091
5094
  }
5092
5095
  } else {
5093
5096
  const config = await GitConfigManager.get({ fs, gitdir });
5094
- const autocrlf = (await config.get('core.autocrlf')) || false;
5097
+ const autocrlf = await config.get('core.autocrlf');
5095
5098
  const object = stats.isSymbolicLink()
5096
5099
  ? await fs.readlink(join(dir, currentFilepath)).then(posixifyPathBuffer)
5097
- : await fs.read(join(dir, currentFilepath), {
5098
- encoding: 'utf8',
5099
- autocrlf,
5100
- });
5100
+ : await fs.read(join(dir, currentFilepath), { autocrlf });
5101
5101
  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
- });
5102
+ const oid = await _writeObject({ fs, gitdir, type: 'blob', object });
5108
5103
  index.insert({ filepath: currentFilepath, stats, oid });
5109
5104
  }
5110
5105
  });
@@ -7379,8 +7374,8 @@ function filterCapabilities(server, client) {
7379
7374
 
7380
7375
  const pkg = {
7381
7376
  name: 'isomorphic-git',
7382
- version: '1.25.8',
7383
- agent: 'git/isomorphic-git@1.25.8',
7377
+ version: '1.25.9',
7378
+ agent: 'git/isomorphic-git@1.25.9',
7384
7379
  };
7385
7380
 
7386
7381
  class FIFO {