isomorphic-git 1.13.0 → 1.13.1

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
@@ -6873,8 +6873,8 @@ function filterCapabilities(server, client) {
6873
6873
 
6874
6874
  const pkg = {
6875
6875
  name: 'isomorphic-git',
6876
- version: '1.13.0',
6877
- agent: 'git/isomorphic-git@1.13.0',
6876
+ version: '1.13.1',
6877
+ agent: 'git/isomorphic-git@1.13.1',
6878
6878
  };
6879
6879
 
6880
6880
  class FIFO {
@@ -13344,27 +13344,37 @@ async function statusMatrix({
13344
13344
  if (!filter(filepath)) return
13345
13345
  }
13346
13346
 
13347
- // For now, just bail on directories
13348
- const headType = head && (await head.type());
13349
- if (headType === 'tree' || headType === 'special') return
13347
+ const [headType, workdirType, stageType] = await Promise.all([
13348
+ head && head.type(),
13349
+ workdir && workdir.type(),
13350
+ stage && stage.type(),
13351
+ ]);
13352
+
13353
+ const isBlob = [headType, workdirType, stageType].includes('blob');
13354
+
13355
+ // For now, bail on directories unless the file is also a blob in another tree
13356
+ if ((headType === 'tree' || headType === 'special') && !isBlob) return
13350
13357
  if (headType === 'commit') return null
13351
13358
 
13352
- const workdirType = workdir && (await workdir.type());
13353
- if (workdirType === 'tree' || workdirType === 'special') return
13359
+ if ((workdirType === 'tree' || workdirType === 'special') && !isBlob)
13360
+ return
13354
13361
 
13355
- const stageType = stage && (await stage.type());
13356
13362
  if (stageType === 'commit') return null
13357
- if (stageType === 'tree' || stageType === 'special') return
13363
+ if ((stageType === 'tree' || stageType === 'special') && !isBlob) return
13358
13364
 
13359
- // Figure out the oids, using the staged oid for the working dir oid if the stats match.
13360
- const headOid = head ? await head.oid() : undefined;
13361
- const stageOid = stage ? await stage.oid() : undefined;
13365
+ // Figure out the oids for files, using the staged oid for the working dir oid if the stats match.
13366
+ const headOid = headType === 'blob' ? await head.oid() : undefined;
13367
+ const stageOid = stageType === 'blob' ? await stage.oid() : undefined;
13362
13368
  let workdirOid;
13363
- if (!head && workdir && !stage) {
13369
+ if (
13370
+ headType !== 'blob' &&
13371
+ workdirType === 'blob' &&
13372
+ stageType !== 'blob'
13373
+ ) {
13364
13374
  // We don't actually NEED the sha. Any sha will do
13365
13375
  // TODO: update this logic to handle N trees instead of just 3.
13366
13376
  workdirOid = '42';
13367
- } else if (workdir) {
13377
+ } else if (workdirType === 'blob') {
13368
13378
  workdirOid = await workdir.oid();
13369
13379
  }
13370
13380
  const entry = [undefined, headOid, workdirOid, stageOid];
package/index.js CHANGED
@@ -6867,8 +6867,8 @@ function filterCapabilities(server, client) {
6867
6867
 
6868
6868
  const pkg = {
6869
6869
  name: 'isomorphic-git',
6870
- version: '1.13.0',
6871
- agent: 'git/isomorphic-git@1.13.0',
6870
+ version: '1.13.1',
6871
+ agent: 'git/isomorphic-git@1.13.1',
6872
6872
  };
6873
6873
 
6874
6874
  class FIFO {
@@ -13338,27 +13338,37 @@ async function statusMatrix({
13338
13338
  if (!filter(filepath)) return
13339
13339
  }
13340
13340
 
13341
- // For now, just bail on directories
13342
- const headType = head && (await head.type());
13343
- if (headType === 'tree' || headType === 'special') return
13341
+ const [headType, workdirType, stageType] = await Promise.all([
13342
+ head && head.type(),
13343
+ workdir && workdir.type(),
13344
+ stage && stage.type(),
13345
+ ]);
13346
+
13347
+ const isBlob = [headType, workdirType, stageType].includes('blob');
13348
+
13349
+ // For now, bail on directories unless the file is also a blob in another tree
13350
+ if ((headType === 'tree' || headType === 'special') && !isBlob) return
13344
13351
  if (headType === 'commit') return null
13345
13352
 
13346
- const workdirType = workdir && (await workdir.type());
13347
- if (workdirType === 'tree' || workdirType === 'special') return
13353
+ if ((workdirType === 'tree' || workdirType === 'special') && !isBlob)
13354
+ return
13348
13355
 
13349
- const stageType = stage && (await stage.type());
13350
13356
  if (stageType === 'commit') return null
13351
- if (stageType === 'tree' || stageType === 'special') return
13357
+ if ((stageType === 'tree' || stageType === 'special') && !isBlob) return
13352
13358
 
13353
- // Figure out the oids, using the staged oid for the working dir oid if the stats match.
13354
- const headOid = head ? await head.oid() : undefined;
13355
- const stageOid = stage ? await stage.oid() : undefined;
13359
+ // Figure out the oids for files, using the staged oid for the working dir oid if the stats match.
13360
+ const headOid = headType === 'blob' ? await head.oid() : undefined;
13361
+ const stageOid = stageType === 'blob' ? await stage.oid() : undefined;
13356
13362
  let workdirOid;
13357
- if (!head && workdir && !stage) {
13363
+ if (
13364
+ headType !== 'blob' &&
13365
+ workdirType === 'blob' &&
13366
+ stageType !== 'blob'
13367
+ ) {
13358
13368
  // We don't actually NEED the sha. Any sha will do
13359
13369
  // TODO: update this logic to handle N trees instead of just 3.
13360
13370
  workdirOid = '42';
13361
- } else if (workdir) {
13371
+ } else if (workdirType === 'blob') {
13362
13372
  workdirOid = await workdir.oid();
13363
13373
  }
13364
13374
  const entry = [undefined, headOid, workdirOid, stageOid];