isomorphic-git 1.44.9 → 1.44.11

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
@@ -466,6 +466,7 @@ Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds
466
466
  <td align="center"><a href="https://github.com/ShahabAhmed01"><img src="https://avatars.githubusercontent.com/u/192491541?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Shahab Ahmed</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ShahabAhmed01" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ShahabAhmed01" title="Tests">⚠️</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=ShahabAhmed01" title="Documentation">📖</a></td>
467
467
  <td align="center"><a href="https://github.com/wleeaf"><img src="https://avatars.githubusercontent.com/u/179125857?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Wleeaf</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=wleeaf" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=wleeaf" title="Tests">⚠️</a></td>
468
468
  <td align="center"><a href="https://github.com/SergioSRcode"><img src="https://avatars.githubusercontent.com/u/104135678?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Sergio</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=SergioSRcode" title="Code">💻</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=SergioSRcode" title="Documentation">📖</a> <a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=SergioSRcode" title="Tests">⚠️</a></td>
469
+ <td align="center"><a href="https://onmax.me/hire"><img src="https://avatars.githubusercontent.com/u/22072217?v=4?s=60" width="60px;" alt=""/><br /><sub><b>Max</b></sub></a><br /><a href="https://github.com/isomorphic-git/isomorphic-git/commits?author=onmax" title="Code">💻</a></td>
469
470
  </tr>
470
471
  </table>
471
472
 
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
6
 
7
7
  var get = _interopDefault(require('simple-get'));
8
+ var stream = require('stream');
8
9
 
9
10
  /**
10
11
  * @typedef {Object} GitProgressEvent
@@ -95,14 +96,12 @@ async function forAwait(iterable, cb) {
95
96
  }
96
97
 
97
98
  function asyncIteratorToStream(iter) {
98
- // @ts-expect-error: readable-stream has PassThrough at runtime, types mismatch
99
- const { PassThrough } = require('readable-stream');
100
- const stream = new PassThrough();
99
+ const stream$1 = new stream.PassThrough();
101
100
  setTimeout(async () => {
102
- await forAwait(iter, chunk => stream.write(chunk));
103
- stream.end();
101
+ await forAwait(iter, chunk => stream$1.write(chunk));
102
+ stream$1.end();
104
103
  }, 1);
105
- return stream
104
+ return stream$1
106
105
  }
107
106
 
108
107
  async function collect(iterable) {
@@ -205,6 +204,7 @@ async function request({
205
204
  // @ts-expect-error
206
205
  body = Buffer.from(await collect(body));
207
206
  } else if (body) {
207
+ // @ts-expect-error
208
208
  body = asyncIteratorToStream(body);
209
209
  }
210
210
  return new Promise((resolve, reject) => {
@@ -1,4 +1,5 @@
1
1
  import get from 'simple-get';
2
+ import { PassThrough } from 'stream';
2
3
 
3
4
  /**
4
5
  * @typedef {Object} GitProgressEvent
@@ -89,8 +90,6 @@ async function forAwait(iterable, cb) {
89
90
  }
90
91
 
91
92
  function asyncIteratorToStream(iter) {
92
- // @ts-expect-error: readable-stream has PassThrough at runtime, types mismatch
93
- const { PassThrough } = require('readable-stream');
94
93
  const stream = new PassThrough();
95
94
  setTimeout(async () => {
96
95
  await forAwait(iter, chunk => stream.write(chunk));
@@ -199,6 +198,7 @@ async function request({
199
198
  // @ts-expect-error
200
199
  body = Buffer.from(await collect(body));
201
200
  } else if (body) {
201
+ // @ts-expect-error
202
202
  body = asyncIteratorToStream(body);
203
203
  }
204
204
  return new Promise((resolve, reject) => {
package/index.cjs CHANGED
@@ -4758,20 +4758,34 @@ class GitCommit {
4758
4758
  const obj = {
4759
4759
  parent: [],
4760
4760
  };
4761
- const seen = new Set();
4762
- for (const h of hs) {
4763
- const key = h.slice(0, h.indexOf(' '));
4764
- const value = h.slice(h.indexOf(' ') + 1);
4765
- if (Array.isArray(obj[key])) {
4766
- obj[key].push(value);
4767
- } else if (!seen.has(key)) {
4768
- // Only `parent` may appear more than once. For every other header the
4769
- // first occurrence wins, the way canonical git reads them. Keeping the
4770
- // last one instead would make a commit with a duplicate `tree` header
4771
- // resolve to a different tree here than in git, under the same oid.
4772
- seen.add(key);
4773
- obj[key] = value;
4774
- }
4761
+ const keyOf = h => h.slice(0, h.indexOf(' '));
4762
+ const valueOf = h => h.slice(h.indexOf(' ') + 1);
4763
+ // Git reads the start of a commit by position: one `tree`, then the
4764
+ // `parent` lines that follow it directly. Anything after that run is an
4765
+ // extra header that git keeps but never interprets, so a `tree` or
4766
+ // `parent` further down must not count here either. Reading them would
4767
+ // give the same oid a different tree, or a different ancestry, than git
4768
+ // and every other implementation reports.
4769
+ if (hs.length === 0 || keyOf(hs[0]) !== 'tree') {
4770
+ throw new ParseError(
4771
+ 'tree as the first commit header',
4772
+ keyOf(hs[0] || '')
4773
+ )
4774
+ }
4775
+ obj.tree = valueOf(hs[0]);
4776
+ let index = 1;
4777
+ while (index < hs.length && keyOf(hs[index]) === 'parent') {
4778
+ obj.parent.push(valueOf(hs[index]));
4779
+ index++;
4780
+ }
4781
+ const seen = new Set(['tree', 'parent']);
4782
+ for (; index < hs.length; index++) {
4783
+ const key = keyOf(hs[index]);
4784
+ // The first occurrence of a single-valued header wins, the way canonical
4785
+ // git reads them.
4786
+ if (seen.has(key)) continue
4787
+ seen.add(key);
4788
+ obj[key] = valueOf(hs[index]);
4775
4789
  }
4776
4790
  if (obj.author) {
4777
4791
  obj.author = parseAuthor(obj.author);
@@ -10280,8 +10294,8 @@ function filterCapabilities(server, client) {
10280
10294
 
10281
10295
  const pkg = {
10282
10296
  name: 'isomorphic-git',
10283
- version: '1.44.9',
10284
- agent: 'git/isomorphic-git@1.44.9',
10297
+ version: '1.44.11',
10298
+ agent: 'git/isomorphic-git@1.44.11',
10285
10299
  };
10286
10300
 
10287
10301
  class FIFO {
package/index.js CHANGED
@@ -4745,20 +4745,34 @@ class GitCommit {
4745
4745
  const obj = {
4746
4746
  parent: [],
4747
4747
  };
4748
- const seen = new Set();
4749
- for (const h of hs) {
4750
- const key = h.slice(0, h.indexOf(' '));
4751
- const value = h.slice(h.indexOf(' ') + 1);
4752
- if (Array.isArray(obj[key])) {
4753
- obj[key].push(value);
4754
- } else if (!seen.has(key)) {
4755
- // Only `parent` may appear more than once. For every other header the
4756
- // first occurrence wins, the way canonical git reads them. Keeping the
4757
- // last one instead would make a commit with a duplicate `tree` header
4758
- // resolve to a different tree here than in git, under the same oid.
4759
- seen.add(key);
4760
- obj[key] = value;
4761
- }
4748
+ const keyOf = h => h.slice(0, h.indexOf(' '));
4749
+ const valueOf = h => h.slice(h.indexOf(' ') + 1);
4750
+ // Git reads the start of a commit by position: one `tree`, then the
4751
+ // `parent` lines that follow it directly. Anything after that run is an
4752
+ // extra header that git keeps but never interprets, so a `tree` or
4753
+ // `parent` further down must not count here either. Reading them would
4754
+ // give the same oid a different tree, or a different ancestry, than git
4755
+ // and every other implementation reports.
4756
+ if (hs.length === 0 || keyOf(hs[0]) !== 'tree') {
4757
+ throw new ParseError(
4758
+ 'tree as the first commit header',
4759
+ keyOf(hs[0] || '')
4760
+ )
4761
+ }
4762
+ obj.tree = valueOf(hs[0]);
4763
+ let index = 1;
4764
+ while (index < hs.length && keyOf(hs[index]) === 'parent') {
4765
+ obj.parent.push(valueOf(hs[index]));
4766
+ index++;
4767
+ }
4768
+ const seen = new Set(['tree', 'parent']);
4769
+ for (; index < hs.length; index++) {
4770
+ const key = keyOf(hs[index]);
4771
+ // The first occurrence of a single-valued header wins, the way canonical
4772
+ // git reads them.
4773
+ if (seen.has(key)) continue
4774
+ seen.add(key);
4775
+ obj[key] = valueOf(hs[index]);
4762
4776
  }
4763
4777
  if (obj.author) {
4764
4778
  obj.author = parseAuthor(obj.author);
@@ -10267,8 +10281,8 @@ function filterCapabilities(server, client) {
10267
10281
 
10268
10282
  const pkg = {
10269
10283
  name: 'isomorphic-git',
10270
- version: '1.44.9',
10271
- agent: 'git/isomorphic-git@1.44.9',
10284
+ version: '1.44.11',
10285
+ agent: 'git/isomorphic-git@1.44.11',
10272
10286
  };
10273
10287
 
10274
10288
  class FIFO {