isomorphic-git 1.37.5 → 1.37.6

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
@@ -7061,7 +7061,7 @@ async function _checkout({
7061
7061
  await GitIndexManager.acquire(
7062
7062
  { fs, gitdir, cache, allowUnmerged: true },
7063
7063
  async function (index) {
7064
- await Promise.all(
7064
+ const settled = await Promise.allSettled(
7065
7065
  ops
7066
7066
  .filter(
7067
7067
  ([method]) =>
@@ -7072,66 +7072,76 @@ async function _checkout({
7072
7072
  )
7073
7073
  .map(async function ([method, fullpath, oid, mode, chmod]) {
7074
7074
  const filepath = `${dir}/${fullpath}`;
7075
- try {
7076
- if (method !== 'create-index' && method !== 'mkdir-index') {
7077
- const { object } = await _readObject({
7078
- fs,
7079
- cache,
7080
- gitdir,
7081
- oid,
7082
- });
7083
- if (chmod) {
7084
- // Note: the mode option of fs.write only works when creating files,
7085
- // not updating them. Since the `fs` plugin doesn't expose `chmod` this
7086
- // is our only option.
7087
- await fs.rm(filepath);
7088
- }
7089
- if (mode === 0o100644) {
7090
- // regular file
7091
- await fs.write(filepath, object);
7092
- } else if (mode === 0o100755) {
7093
- // executable file
7094
- await fs.write(filepath, object, { mode: 0o777 });
7095
- } else if (mode === 0o120000) {
7096
- // symlink
7097
- await fs.writelink(filepath, object);
7098
- } else {
7099
- throw new InternalError(
7100
- `Invalid mode 0o${mode.toString(
7101
- 8
7102
- )} detected in blob ${oid}`
7103
- )
7104
- }
7105
- }
7106
-
7107
- const stats = await fs.lstat(filepath);
7108
- // We can't trust the executable bit returned by lstat on Windows,
7109
- // so we need to preserve this value from the TREE.
7110
- // TODO: Figure out how git handles this internally.
7111
- if (mode === 0o100755) {
7112
- stats.mode = 0o755;
7113
- }
7114
- // Submodules are present in the git index but use a unique mode different from trees
7115
- if (method === 'mkdir-index') {
7116
- stats.mode = 0o160000;
7117
- }
7118
- index.insert({
7119
- filepath: fullpath,
7120
- stats,
7075
+ if (method !== 'create-index' && method !== 'mkdir-index') {
7076
+ const { object } = await _readObject({
7077
+ fs,
7078
+ cache,
7079
+ gitdir,
7121
7080
  oid,
7122
7081
  });
7123
- if (onProgress) {
7124
- await onProgress({
7125
- phase: 'Updating workdir',
7126
- loaded: ++count,
7127
- total,
7128
- });
7082
+ if (chmod) {
7083
+ // Note: the mode option of fs.write only works when creating files,
7084
+ // not updating them. Since the `fs` plugin doesn't expose `chmod` this
7085
+ // is our only option.
7086
+ await fs.rm(filepath);
7087
+ }
7088
+ if (mode === 0o100644) {
7089
+ // regular file
7090
+ await fs.write(filepath, object);
7091
+ } else if (mode === 0o100755) {
7092
+ // executable file
7093
+ await fs.write(filepath, object, { mode: 0o777 });
7094
+ } else if (mode === 0o120000) {
7095
+ // symlink
7096
+ await fs.writelink(filepath, object);
7097
+ } else {
7098
+ throw new InternalError(
7099
+ `Invalid mode 0o${mode.toString(
7100
+ 8
7101
+ )} detected in blob ${oid}`
7102
+ )
7129
7103
  }
7130
- } catch (e) {
7131
- console.log(e);
7104
+ }
7105
+
7106
+ const stats = await fs.lstat(filepath);
7107
+ // We can't trust the executable bit returned by lstat on Windows,
7108
+ // so we need to preserve this value from the TREE.
7109
+ // TODO: Figure out how git handles this internally.
7110
+ if (mode === 0o100755) {
7111
+ stats.mode = 0o755;
7112
+ }
7113
+ // Submodules are present in the git index but use a unique mode different from trees
7114
+ if (method === 'mkdir-index') {
7115
+ stats.mode = 0o160000;
7116
+ }
7117
+ index.insert({
7118
+ filepath: fullpath,
7119
+ stats,
7120
+ oid,
7121
+ });
7122
+ if (onProgress) {
7123
+ await onProgress({
7124
+ phase: 'Updating workdir',
7125
+ loaded: ++count,
7126
+ total,
7127
+ });
7132
7128
  }
7133
7129
  })
7134
7130
  );
7131
+ const rejections = [];
7132
+ for (const result of settled) {
7133
+ if (result.status === 'rejected') {
7134
+ rejections.push(result.reason);
7135
+ // eslint-disable-next-line no-console
7136
+ console.error(
7137
+ '[isomorphic-git checkout] task rejected:',
7138
+ result.reason?.stack ?? result.reason
7139
+ );
7140
+ }
7141
+ }
7142
+ if (rejections.length > 0) {
7143
+ throw new MultipleGitError(rejections)
7144
+ }
7135
7145
  }
7136
7146
  );
7137
7147
  }
@@ -7500,27 +7510,34 @@ async function updateWorkingDir(
7500
7510
 
7501
7511
  async function batchAllSettled(operationName, tasks, onProgress, batchSize) {
7502
7512
  const results = [];
7503
- try {
7504
- for (let i = 0; i < tasks.length; i += batchSize) {
7505
- const batch = tasks.slice(i, i + batchSize).map(task => task());
7506
- const batchResults = await Promise.allSettled(batch);
7507
- batchResults.forEach(result => {
7508
- if (result.status === 'fulfilled') results.push(result.value);
7509
- });
7510
- if (onProgress) {
7511
- await onProgress({
7512
- phase: 'Updating workdir',
7513
- loaded: i + batch.length,
7514
- total: tasks.length,
7515
- });
7513
+ const rejections = [];
7514
+ for (let i = 0; i < tasks.length; i += batchSize) {
7515
+ const batch = tasks.slice(i, i + batchSize).map(task => task());
7516
+ const batchResults = await Promise.allSettled(batch);
7517
+ batchResults.forEach(result => {
7518
+ if (result.status === 'fulfilled') {
7519
+ results.push(result.value);
7520
+ } else {
7521
+ rejections.push(result.reason);
7522
+ // eslint-disable-next-line no-console
7523
+ console.error(
7524
+ `[isomorphic-git ${operationName}] task rejected:`,
7525
+ result.reason?.stack ?? result.reason
7526
+ );
7516
7527
  }
7528
+ });
7529
+ if (onProgress) {
7530
+ await onProgress({
7531
+ phase: 'Updating workdir',
7532
+ loaded: i + batch.length,
7533
+ total: tasks.length,
7534
+ });
7517
7535
  }
7518
-
7519
- return results
7520
- } catch (error) {
7521
- console.error(`Error during ${operationName}: ${error}`);
7522
7536
  }
7523
7537
 
7538
+ if (rejections.length > 0) {
7539
+ throw new MultipleGitError(rejections)
7540
+ }
7524
7541
  return results
7525
7542
  }
7526
7543
 
@@ -9326,8 +9343,8 @@ function filterCapabilities(server, client) {
9326
9343
 
9327
9344
  const pkg = {
9328
9345
  name: 'isomorphic-git',
9329
- version: '1.37.5',
9330
- agent: 'git/isomorphic-git@1.37.5',
9346
+ version: '1.37.6',
9347
+ agent: 'git/isomorphic-git@1.37.6',
9331
9348
  };
9332
9349
 
9333
9350
  class FIFO {
package/index.js CHANGED
@@ -7048,7 +7048,7 @@ async function _checkout({
7048
7048
  await GitIndexManager.acquire(
7049
7049
  { fs, gitdir, cache, allowUnmerged: true },
7050
7050
  async function (index) {
7051
- await Promise.all(
7051
+ const settled = await Promise.allSettled(
7052
7052
  ops
7053
7053
  .filter(
7054
7054
  ([method]) =>
@@ -7059,66 +7059,76 @@ async function _checkout({
7059
7059
  )
7060
7060
  .map(async function ([method, fullpath, oid, mode, chmod]) {
7061
7061
  const filepath = `${dir}/${fullpath}`;
7062
- try {
7063
- if (method !== 'create-index' && method !== 'mkdir-index') {
7064
- const { object } = await _readObject({
7065
- fs,
7066
- cache,
7067
- gitdir,
7068
- oid,
7069
- });
7070
- if (chmod) {
7071
- // Note: the mode option of fs.write only works when creating files,
7072
- // not updating them. Since the `fs` plugin doesn't expose `chmod` this
7073
- // is our only option.
7074
- await fs.rm(filepath);
7075
- }
7076
- if (mode === 0o100644) {
7077
- // regular file
7078
- await fs.write(filepath, object);
7079
- } else if (mode === 0o100755) {
7080
- // executable file
7081
- await fs.write(filepath, object, { mode: 0o777 });
7082
- } else if (mode === 0o120000) {
7083
- // symlink
7084
- await fs.writelink(filepath, object);
7085
- } else {
7086
- throw new InternalError(
7087
- `Invalid mode 0o${mode.toString(
7088
- 8
7089
- )} detected in blob ${oid}`
7090
- )
7091
- }
7092
- }
7093
-
7094
- const stats = await fs.lstat(filepath);
7095
- // We can't trust the executable bit returned by lstat on Windows,
7096
- // so we need to preserve this value from the TREE.
7097
- // TODO: Figure out how git handles this internally.
7098
- if (mode === 0o100755) {
7099
- stats.mode = 0o755;
7100
- }
7101
- // Submodules are present in the git index but use a unique mode different from trees
7102
- if (method === 'mkdir-index') {
7103
- stats.mode = 0o160000;
7104
- }
7105
- index.insert({
7106
- filepath: fullpath,
7107
- stats,
7062
+ if (method !== 'create-index' && method !== 'mkdir-index') {
7063
+ const { object } = await _readObject({
7064
+ fs,
7065
+ cache,
7066
+ gitdir,
7108
7067
  oid,
7109
7068
  });
7110
- if (onProgress) {
7111
- await onProgress({
7112
- phase: 'Updating workdir',
7113
- loaded: ++count,
7114
- total,
7115
- });
7069
+ if (chmod) {
7070
+ // Note: the mode option of fs.write only works when creating files,
7071
+ // not updating them. Since the `fs` plugin doesn't expose `chmod` this
7072
+ // is our only option.
7073
+ await fs.rm(filepath);
7074
+ }
7075
+ if (mode === 0o100644) {
7076
+ // regular file
7077
+ await fs.write(filepath, object);
7078
+ } else if (mode === 0o100755) {
7079
+ // executable file
7080
+ await fs.write(filepath, object, { mode: 0o777 });
7081
+ } else if (mode === 0o120000) {
7082
+ // symlink
7083
+ await fs.writelink(filepath, object);
7084
+ } else {
7085
+ throw new InternalError(
7086
+ `Invalid mode 0o${mode.toString(
7087
+ 8
7088
+ )} detected in blob ${oid}`
7089
+ )
7116
7090
  }
7117
- } catch (e) {
7118
- console.log(e);
7091
+ }
7092
+
7093
+ const stats = await fs.lstat(filepath);
7094
+ // We can't trust the executable bit returned by lstat on Windows,
7095
+ // so we need to preserve this value from the TREE.
7096
+ // TODO: Figure out how git handles this internally.
7097
+ if (mode === 0o100755) {
7098
+ stats.mode = 0o755;
7099
+ }
7100
+ // Submodules are present in the git index but use a unique mode different from trees
7101
+ if (method === 'mkdir-index') {
7102
+ stats.mode = 0o160000;
7103
+ }
7104
+ index.insert({
7105
+ filepath: fullpath,
7106
+ stats,
7107
+ oid,
7108
+ });
7109
+ if (onProgress) {
7110
+ await onProgress({
7111
+ phase: 'Updating workdir',
7112
+ loaded: ++count,
7113
+ total,
7114
+ });
7119
7115
  }
7120
7116
  })
7121
7117
  );
7118
+ const rejections = [];
7119
+ for (const result of settled) {
7120
+ if (result.status === 'rejected') {
7121
+ rejections.push(result.reason);
7122
+ // eslint-disable-next-line no-console
7123
+ console.error(
7124
+ '[isomorphic-git checkout] task rejected:',
7125
+ result.reason?.stack ?? result.reason
7126
+ );
7127
+ }
7128
+ }
7129
+ if (rejections.length > 0) {
7130
+ throw new MultipleGitError(rejections)
7131
+ }
7122
7132
  }
7123
7133
  );
7124
7134
  }
@@ -7487,27 +7497,34 @@ async function updateWorkingDir(
7487
7497
 
7488
7498
  async function batchAllSettled(operationName, tasks, onProgress, batchSize) {
7489
7499
  const results = [];
7490
- try {
7491
- for (let i = 0; i < tasks.length; i += batchSize) {
7492
- const batch = tasks.slice(i, i + batchSize).map(task => task());
7493
- const batchResults = await Promise.allSettled(batch);
7494
- batchResults.forEach(result => {
7495
- if (result.status === 'fulfilled') results.push(result.value);
7496
- });
7497
- if (onProgress) {
7498
- await onProgress({
7499
- phase: 'Updating workdir',
7500
- loaded: i + batch.length,
7501
- total: tasks.length,
7502
- });
7500
+ const rejections = [];
7501
+ for (let i = 0; i < tasks.length; i += batchSize) {
7502
+ const batch = tasks.slice(i, i + batchSize).map(task => task());
7503
+ const batchResults = await Promise.allSettled(batch);
7504
+ batchResults.forEach(result => {
7505
+ if (result.status === 'fulfilled') {
7506
+ results.push(result.value);
7507
+ } else {
7508
+ rejections.push(result.reason);
7509
+ // eslint-disable-next-line no-console
7510
+ console.error(
7511
+ `[isomorphic-git ${operationName}] task rejected:`,
7512
+ result.reason?.stack ?? result.reason
7513
+ );
7503
7514
  }
7515
+ });
7516
+ if (onProgress) {
7517
+ await onProgress({
7518
+ phase: 'Updating workdir',
7519
+ loaded: i + batch.length,
7520
+ total: tasks.length,
7521
+ });
7504
7522
  }
7505
-
7506
- return results
7507
- } catch (error) {
7508
- console.error(`Error during ${operationName}: ${error}`);
7509
7523
  }
7510
7524
 
7525
+ if (rejections.length > 0) {
7526
+ throw new MultipleGitError(rejections)
7527
+ }
7511
7528
  return results
7512
7529
  }
7513
7530
 
@@ -9313,8 +9330,8 @@ function filterCapabilities(server, client) {
9313
9330
 
9314
9331
  const pkg = {
9315
9332
  name: 'isomorphic-git',
9316
- version: '1.37.5',
9317
- agent: 'git/isomorphic-git@1.37.5',
9333
+ version: '1.37.6',
9334
+ agent: 'git/isomorphic-git@1.37.6',
9318
9335
  };
9319
9336
 
9320
9337
  class FIFO {