isomorphic-git 1.37.3 → 1.37.4

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
@@ -3273,12 +3273,13 @@ class GitPackIndex {
3273
3273
  0b1100000: 'ofs_delta',
3274
3274
  0b1110000: 'ref_delta',
3275
3275
  };
3276
- if (!this.pack) {
3276
+ const pack = await this.pack;
3277
+ if (!pack) {
3277
3278
  throw new InternalError(
3278
- 'Tried to read from a GitPackIndex with no packfile loaded into memory'
3279
+ 'Could not read packfile data. The packfile may be missing, corrupted, or too large to read into memory.'
3279
3280
  )
3280
3281
  }
3281
- const raw = (await this.pack).slice(start);
3282
+ const raw = pack.slice(start);
3282
3283
  const reader = new BufferCursor(raw);
3283
3284
  const byte = reader.readUInt8();
3284
3285
  // Object type is encoded in bits 654
@@ -3390,12 +3391,18 @@ async function readObjectPacked({
3390
3391
  if (p.error) throw new InternalError(p.error)
3391
3392
  // If the packfile DOES have the oid we're looking for...
3392
3393
  if (p.offsets.has(oid)) {
3393
- // Get the resolved git object from the packfile
3394
+ // Derive the .pack path from the .idx path
3395
+ const packFile = indexFile.replace(/idx$/, 'pack');
3394
3396
  if (!p.pack) {
3395
- const packFile = indexFile.replace(/idx$/, 'pack');
3396
3397
  p.pack = fs.read(packFile);
3397
3398
  }
3398
3399
  const pack = await p.pack;
3400
+ if (!pack) {
3401
+ p.pack = null;
3402
+ throw new InternalError(
3403
+ `Could not read packfile at ${packFile}. The file may be missing, corrupted, or too large to read into memory.`
3404
+ )
3405
+ }
3399
3406
 
3400
3407
  // === Packfile Integrity Verification ===
3401
3408
  // Performance optimization: use _checksumVerified flag to verify only once per packfile
@@ -9304,8 +9311,8 @@ function filterCapabilities(server, client) {
9304
9311
 
9305
9312
  const pkg = {
9306
9313
  name: 'isomorphic-git',
9307
- version: '1.37.3',
9308
- agent: 'git/isomorphic-git@1.37.3',
9314
+ version: '1.37.4',
9315
+ agent: 'git/isomorphic-git@1.37.4',
9309
9316
  };
9310
9317
 
9311
9318
  class FIFO {
package/index.js CHANGED
@@ -3267,12 +3267,13 @@ class GitPackIndex {
3267
3267
  0b1100000: 'ofs_delta',
3268
3268
  0b1110000: 'ref_delta',
3269
3269
  };
3270
- if (!this.pack) {
3270
+ const pack = await this.pack;
3271
+ if (!pack) {
3271
3272
  throw new InternalError(
3272
- 'Tried to read from a GitPackIndex with no packfile loaded into memory'
3273
+ 'Could not read packfile data. The packfile may be missing, corrupted, or too large to read into memory.'
3273
3274
  )
3274
3275
  }
3275
- const raw = (await this.pack).slice(start);
3276
+ const raw = pack.slice(start);
3276
3277
  const reader = new BufferCursor(raw);
3277
3278
  const byte = reader.readUInt8();
3278
3279
  // Object type is encoded in bits 654
@@ -3384,12 +3385,18 @@ async function readObjectPacked({
3384
3385
  if (p.error) throw new InternalError(p.error)
3385
3386
  // If the packfile DOES have the oid we're looking for...
3386
3387
  if (p.offsets.has(oid)) {
3387
- // Get the resolved git object from the packfile
3388
+ // Derive the .pack path from the .idx path
3389
+ const packFile = indexFile.replace(/idx$/, 'pack');
3388
3390
  if (!p.pack) {
3389
- const packFile = indexFile.replace(/idx$/, 'pack');
3390
3391
  p.pack = fs.read(packFile);
3391
3392
  }
3392
3393
  const pack = await p.pack;
3394
+ if (!pack) {
3395
+ p.pack = null;
3396
+ throw new InternalError(
3397
+ `Could not read packfile at ${packFile}. The file may be missing, corrupted, or too large to read into memory.`
3398
+ )
3399
+ }
3393
3400
 
3394
3401
  // === Packfile Integrity Verification ===
3395
3402
  // Performance optimization: use _checksumVerified flag to verify only once per packfile
@@ -9298,8 +9305,8 @@ function filterCapabilities(server, client) {
9298
9305
 
9299
9306
  const pkg = {
9300
9307
  name: 'isomorphic-git',
9301
- version: '1.37.3',
9302
- agent: 'git/isomorphic-git@1.37.3',
9308
+ version: '1.37.4',
9309
+ agent: 'git/isomorphic-git@1.37.4',
9303
9310
  };
9304
9311
 
9305
9312
  class FIFO {