isomorphic-git 1.44.8 → 1.44.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/index.cjs CHANGED
@@ -622,7 +622,8 @@ function SecondsNanoseconds(
622
622
  milliseconds = date.valueOf();
623
623
  }
624
624
  const seconds = Math.floor(milliseconds / 1000);
625
- const nanoseconds = (milliseconds - seconds * 1000) * 1000000;
625
+ // Match the integer precision used when these timestamps are written to the index.
626
+ const nanoseconds = Math.floor((milliseconds - seconds * 1000) * 1000000);
626
627
  return [seconds, nanoseconds]
627
628
  }
628
629
 
@@ -1043,7 +1044,9 @@ function compareStats(entry, stats, filemode = true, trustino = true) {
1043
1044
  const staleness =
1044
1045
  (filemode && e.mode !== s.mode) ||
1045
1046
  e.mtimeSeconds !== s.mtimeSeconds ||
1047
+ e.mtimeNanoseconds !== s.mtimeNanoseconds ||
1046
1048
  e.ctimeSeconds !== s.ctimeSeconds ||
1049
+ e.ctimeNanoseconds !== s.ctimeNanoseconds ||
1047
1050
  e.uid !== s.uid ||
1048
1051
  e.gid !== s.gid ||
1049
1052
  (trustino && e.ino !== s.ino) ||
@@ -4615,12 +4618,16 @@ ${obj.gpgsig ? obj.gpgsig : ''}`
4615
4618
  }
4616
4619
  }
4617
4620
  const obj = {};
4621
+ const seen = new Set();
4618
4622
  for (const h of hs) {
4619
4623
  const key = h.slice(0, h.indexOf(' '));
4620
4624
  const value = h.slice(h.indexOf(' ') + 1);
4621
- if (Array.isArray(obj[key])) {
4622
- obj[key].push(value);
4623
- } else {
4625
+ // A tag header may appear only once, so the first occurrence wins, the
4626
+ // way canonical git reads them. Keeping the last one instead would make a
4627
+ // tag with a duplicate `object` header point at a different target here
4628
+ // than in git, under the same oid.
4629
+ if (!seen.has(key)) {
4630
+ seen.add(key);
4624
4631
  obj[key] = value;
4625
4632
  }
4626
4633
  }
@@ -4751,12 +4758,18 @@ class GitCommit {
4751
4758
  const obj = {
4752
4759
  parent: [],
4753
4760
  };
4761
+ const seen = new Set();
4754
4762
  for (const h of hs) {
4755
4763
  const key = h.slice(0, h.indexOf(' '));
4756
4764
  const value = h.slice(h.indexOf(' ') + 1);
4757
4765
  if (Array.isArray(obj[key])) {
4758
4766
  obj[key].push(value);
4759
- } else {
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);
4760
4773
  obj[key] = value;
4761
4774
  }
4762
4775
  }
@@ -10267,8 +10280,8 @@ function filterCapabilities(server, client) {
10267
10280
 
10268
10281
  const pkg = {
10269
10282
  name: 'isomorphic-git',
10270
- version: '1.44.8',
10271
- agent: 'git/isomorphic-git@1.44.8',
10283
+ version: '1.44.9',
10284
+ agent: 'git/isomorphic-git@1.44.9',
10272
10285
  };
10273
10286
 
10274
10287
  class FIFO {
package/index.js CHANGED
@@ -615,7 +615,8 @@ function SecondsNanoseconds(
615
615
  milliseconds = date.valueOf();
616
616
  }
617
617
  const seconds = Math.floor(milliseconds / 1000);
618
- const nanoseconds = (milliseconds - seconds * 1000) * 1000000;
618
+ // Match the integer precision used when these timestamps are written to the index.
619
+ const nanoseconds = Math.floor((milliseconds - seconds * 1000) * 1000000);
619
620
  return [seconds, nanoseconds]
620
621
  }
621
622
 
@@ -1036,7 +1037,9 @@ function compareStats(entry, stats, filemode = true, trustino = true) {
1036
1037
  const staleness =
1037
1038
  (filemode && e.mode !== s.mode) ||
1038
1039
  e.mtimeSeconds !== s.mtimeSeconds ||
1040
+ e.mtimeNanoseconds !== s.mtimeNanoseconds ||
1039
1041
  e.ctimeSeconds !== s.ctimeSeconds ||
1042
+ e.ctimeNanoseconds !== s.ctimeNanoseconds ||
1040
1043
  e.uid !== s.uid ||
1041
1044
  e.gid !== s.gid ||
1042
1045
  (trustino && e.ino !== s.ino) ||
@@ -4602,12 +4605,16 @@ ${obj.gpgsig ? obj.gpgsig : ''}`
4602
4605
  }
4603
4606
  }
4604
4607
  const obj = {};
4608
+ const seen = new Set();
4605
4609
  for (const h of hs) {
4606
4610
  const key = h.slice(0, h.indexOf(' '));
4607
4611
  const value = h.slice(h.indexOf(' ') + 1);
4608
- if (Array.isArray(obj[key])) {
4609
- obj[key].push(value);
4610
- } else {
4612
+ // A tag header may appear only once, so the first occurrence wins, the
4613
+ // way canonical git reads them. Keeping the last one instead would make a
4614
+ // tag with a duplicate `object` header point at a different target here
4615
+ // than in git, under the same oid.
4616
+ if (!seen.has(key)) {
4617
+ seen.add(key);
4611
4618
  obj[key] = value;
4612
4619
  }
4613
4620
  }
@@ -4738,12 +4745,18 @@ class GitCommit {
4738
4745
  const obj = {
4739
4746
  parent: [],
4740
4747
  };
4748
+ const seen = new Set();
4741
4749
  for (const h of hs) {
4742
4750
  const key = h.slice(0, h.indexOf(' '));
4743
4751
  const value = h.slice(h.indexOf(' ') + 1);
4744
4752
  if (Array.isArray(obj[key])) {
4745
4753
  obj[key].push(value);
4746
- } else {
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);
4747
4760
  obj[key] = value;
4748
4761
  }
4749
4762
  }
@@ -10254,8 +10267,8 @@ function filterCapabilities(server, client) {
10254
10267
 
10255
10268
  const pkg = {
10256
10269
  name: 'isomorphic-git',
10257
- version: '1.44.8',
10258
- agent: 'git/isomorphic-git@1.44.8',
10270
+ version: '1.44.9',
10271
+ agent: 'git/isomorphic-git@1.44.9',
10259
10272
  };
10260
10273
 
10261
10274
  class FIFO {