isomorphic-git 1.44.11 → 1.44.13

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.cjs CHANGED
@@ -4,12 +4,11 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
6
6
 
7
- var Hash = _interopDefault(require('sha.js/sha1.js'));
7
+ var crypto$1 = require('crypto');
8
8
  var AsyncLock = _interopDefault(require('async-lock'));
9
9
  var cleanGitRef = _interopDefault(require('clean-git-ref'));
10
10
  var crc32 = _interopDefault(require('crc-32'));
11
11
  var pako = _interopDefault(require('pako'));
12
- var crypto$1 = require('crypto');
13
12
  var pify = _interopDefault(require('pify'));
14
13
  var ignore = _interopDefault(require('ignore'));
15
14
  var diff3Merge = _interopDefault(require('diff3'));
@@ -657,6 +656,10 @@ function normalizeStats(e) {
657
656
  }
658
657
  }
659
658
 
659
+ function createSha1() {
660
+ return crypto$1.createHash('sha1')
661
+ }
662
+
660
663
  function toHex(buffer) {
661
664
  let hex = '';
662
665
  for (const byte of new Uint8Array(buffer)) {
@@ -681,7 +684,7 @@ async function shasum(buffer) {
681
684
  // but without the 'json-stable-stringify' dependency and
682
685
  // extra type-casting features.
683
686
  function shasumSync(buffer) {
684
- return new Hash().update(buffer).digest('hex')
687
+ return createSha1().update(buffer).digest('hex')
685
688
  }
686
689
 
687
690
  async function subtleSHA1(buffer) {
@@ -8466,6 +8469,11 @@ async function checkout({
8466
8469
 
8467
8470
  const LINEBREAKS = /^.*(\r?\n|$)/gm;
8468
8471
 
8472
+ function formatConflictSide(lines) {
8473
+ const text = lines.join('');
8474
+ return text && !text.endsWith('\n') ? `${text}\n` : text
8475
+ }
8476
+
8469
8477
  function mergeFile({ branches, contents }) {
8470
8478
  const ourName = branches[1];
8471
8479
  const theirName = branches[2];
@@ -8494,10 +8502,10 @@ function mergeFile({ branches, contents }) {
8494
8502
  if (item.conflict) {
8495
8503
  cleanMerge = false;
8496
8504
  mergedText += `${'<'.repeat(markerSize)} ${ourName}\n`;
8497
- mergedText += item.conflict.a.join('');
8505
+ mergedText += formatConflictSide(item.conflict.a);
8498
8506
 
8499
8507
  mergedText += `${'='.repeat(markerSize)}\n`;
8500
- mergedText += item.conflict.b.join('');
8508
+ mergedText += formatConflictSide(item.conflict.b);
8501
8509
  mergedText += `${'>'.repeat(markerSize)} ${theirName}\n`;
8502
8510
  }
8503
8511
  }
@@ -10294,8 +10302,8 @@ function filterCapabilities(server, client) {
10294
10302
 
10295
10303
  const pkg = {
10296
10304
  name: 'isomorphic-git',
10297
- version: '1.44.11',
10298
- agent: 'git/isomorphic-git@1.44.11',
10305
+ version: '1.44.13',
10306
+ agent: 'git/isomorphic-git@1.44.13',
10299
10307
  };
10300
10308
 
10301
10309
  class FIFO {
@@ -10923,9 +10931,12 @@ async function _fetch({
10923
10931
  }
10924
10932
  }
10925
10933
  const noun = fullref.startsWith('refs/tags') ? 'tag' : 'branch';
10934
+ // Like canonical git, leave any credentials embedded in the URL out of the
10935
+ // description, because `pull` writes it into the merge commit message.
10936
+ const { url: urlWithoutAuth } = extractAuthFromUrl(url);
10926
10937
  response.FETCH_HEAD = {
10927
10938
  oid,
10928
- description: `${noun} '${abbreviateRef(fullref)}' of ${url}`,
10939
+ description: `${noun} '${abbreviateRef(fullref)}' of ${urlWithoutAuth}`,
10929
10940
  };
10930
10941
 
10931
10942
  if (onProgress || onMessage) {
@@ -14425,7 +14436,7 @@ async function _pack({
14425
14436
  gitdir = join(dir, '.git'),
14426
14437
  oids,
14427
14438
  }) {
14428
- const hash = new Hash();
14439
+ const hash = createSha1();
14429
14440
  const outputStream = [];
14430
14441
  function write(chunk, enc) {
14431
14442
  const buff = Buffer.from(chunk, enc);
package/index.js CHANGED
@@ -650,6 +650,10 @@ function normalizeStats(e) {
650
650
  }
651
651
  }
652
652
 
653
+ function createSha1() {
654
+ return new Hash()
655
+ }
656
+
653
657
  function toHex(buffer) {
654
658
  let hex = '';
655
659
  for (const byte of new Uint8Array(buffer)) {
@@ -674,7 +678,7 @@ async function shasum(buffer) {
674
678
  // but without the 'json-stable-stringify' dependency and
675
679
  // extra type-casting features.
676
680
  function shasumSync(buffer) {
677
- return new Hash().update(buffer).digest('hex')
681
+ return createSha1().update(buffer).digest('hex')
678
682
  }
679
683
 
680
684
  async function subtleSHA1(buffer) {
@@ -8453,6 +8457,11 @@ async function checkout({
8453
8457
 
8454
8458
  const LINEBREAKS = /^.*(\r?\n|$)/gm;
8455
8459
 
8460
+ function formatConflictSide(lines) {
8461
+ const text = lines.join('');
8462
+ return text && !text.endsWith('\n') ? `${text}\n` : text
8463
+ }
8464
+
8456
8465
  function mergeFile({ branches, contents }) {
8457
8466
  const ourName = branches[1];
8458
8467
  const theirName = branches[2];
@@ -8481,10 +8490,10 @@ function mergeFile({ branches, contents }) {
8481
8490
  if (item.conflict) {
8482
8491
  cleanMerge = false;
8483
8492
  mergedText += `${'<'.repeat(markerSize)} ${ourName}\n`;
8484
- mergedText += item.conflict.a.join('');
8493
+ mergedText += formatConflictSide(item.conflict.a);
8485
8494
 
8486
8495
  mergedText += `${'='.repeat(markerSize)}\n`;
8487
- mergedText += item.conflict.b.join('');
8496
+ mergedText += formatConflictSide(item.conflict.b);
8488
8497
  mergedText += `${'>'.repeat(markerSize)} ${theirName}\n`;
8489
8498
  }
8490
8499
  }
@@ -10281,8 +10290,8 @@ function filterCapabilities(server, client) {
10281
10290
 
10282
10291
  const pkg = {
10283
10292
  name: 'isomorphic-git',
10284
- version: '1.44.11',
10285
- agent: 'git/isomorphic-git@1.44.11',
10293
+ version: '1.44.13',
10294
+ agent: 'git/isomorphic-git@1.44.13',
10286
10295
  };
10287
10296
 
10288
10297
  class FIFO {
@@ -10910,9 +10919,12 @@ async function _fetch({
10910
10919
  }
10911
10920
  }
10912
10921
  const noun = fullref.startsWith('refs/tags') ? 'tag' : 'branch';
10922
+ // Like canonical git, leave any credentials embedded in the URL out of the
10923
+ // description, because `pull` writes it into the merge commit message.
10924
+ const { url: urlWithoutAuth } = extractAuthFromUrl(url);
10913
10925
  response.FETCH_HEAD = {
10914
10926
  oid,
10915
- description: `${noun} '${abbreviateRef(fullref)}' of ${url}`,
10927
+ description: `${noun} '${abbreviateRef(fullref)}' of ${urlWithoutAuth}`,
10916
10928
  };
10917
10929
 
10918
10930
  if (onProgress || onMessage) {
@@ -14412,7 +14424,7 @@ async function _pack({
14412
14424
  gitdir = join(dir, '.git'),
14413
14425
  oids,
14414
14426
  }) {
14415
- const hash = new Hash();
14427
+ const hash = createSha1();
14416
14428
  const outputStream = [];
14417
14429
  function write(chunk, enc) {
14418
14430
  const buff = Buffer.from(chunk, enc);