isomorphic-git 1.44.11 → 1.44.12

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.12',
10306
+ agent: 'git/isomorphic-git@1.44.12',
10299
10307
  };
10300
10308
 
10301
10309
  class FIFO {
@@ -14425,7 +14433,7 @@ async function _pack({
14425
14433
  gitdir = join(dir, '.git'),
14426
14434
  oids,
14427
14435
  }) {
14428
- const hash = new Hash();
14436
+ const hash = createSha1();
14429
14437
  const outputStream = [];
14430
14438
  function write(chunk, enc) {
14431
14439
  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.12',
10294
+ agent: 'git/isomorphic-git@1.44.12',
10286
10295
  };
10287
10296
 
10288
10297
  class FIFO {
@@ -14412,7 +14421,7 @@ async function _pack({
14412
14421
  gitdir = join(dir, '.git'),
14413
14422
  oids,
14414
14423
  }) {
14415
- const hash = new Hash();
14424
+ const hash = createSha1();
14416
14425
  const outputStream = [];
14417
14426
  function write(chunk, enc) {
14418
14427
  const buff = Buffer.from(chunk, enc);