isomorphic-git 1.38.2 → 1.38.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
@@ -402,7 +402,7 @@ class InternalError extends BaseError {
402
402
  */
403
403
  constructor(message) {
404
404
  super(
405
- `An internal error caused this command to fail.\n\nIf you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment.\n\nPlease file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${message}`
405
+ `An internal error caused this command to fail.\n\nIf you're using an application that depends on isomorphic-git, please report this error to that application's developers.\n\nIf you're a developer and you believe this is a bug in isomorphic-git, please file an issue at https://github.com/isomorphic-git/isomorphic-git/issues with a minimal reproduction, version and environment details, and this error message: ${message}`
406
406
  );
407
407
  this.code = this.name = InternalError.code;
408
408
  this.data = { message };
@@ -9331,6 +9331,16 @@ async function hasObject({
9331
9331
  return result
9332
9332
  }
9333
9333
 
9334
+ function addCredentialUsername({ config, onAuth }) {
9335
+ if (!onAuth) return onAuth
9336
+
9337
+ return async (url, auth) => {
9338
+ const username =
9339
+ auth.username || (await config.get(`credential.${url}.username`));
9340
+ return onAuth(url, username ? { ...auth, username } : auth)
9341
+ }
9342
+ }
9343
+
9334
9344
  // TODO: make a function that just returns obCount. then emptyPackfile = () => sizePack(pack) === 0
9335
9345
  function emptyPackfile(pack) {
9336
9346
  const pheader = '5041434b';
@@ -9350,8 +9360,8 @@ function filterCapabilities(server, client) {
9350
9360
 
9351
9361
  const pkg = {
9352
9362
  name: 'isomorphic-git',
9353
- version: '1.38.2',
9354
- agent: 'git/isomorphic-git@1.38.2',
9363
+ version: '1.38.4',
9364
+ agent: 'git/isomorphic-git@1.38.4',
9355
9365
  };
9356
9366
 
9357
9367
  class FIFO {
@@ -9765,9 +9775,9 @@ async function _fetch({
9765
9775
  const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url });
9766
9776
  const remoteHTTP = await GitRemoteHTTP.discover({
9767
9777
  http,
9768
- onAuth,
9778
+ onAuth: addCredentialUsername({ config, onAuth }),
9769
9779
  onAuthSuccess,
9770
- onAuthFailure,
9780
+ onAuthFailure: addCredentialUsername({ config, onAuth: onAuthFailure }),
9771
9781
  corsProxy,
9772
9782
  service: 'git-upload-pack',
9773
9783
  url,
@@ -13886,9 +13896,9 @@ async function _push({
13886
13896
  const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url });
13887
13897
  const httpRemote = await GitRemoteHTTP.discover({
13888
13898
  http,
13889
- onAuth,
13899
+ onAuth: addCredentialUsername({ config, onAuth }),
13890
13900
  onAuthSuccess,
13891
- onAuthFailure,
13901
+ onAuthFailure: addCredentialUsername({ config, onAuth: onAuthFailure }),
13892
13902
  corsProxy,
13893
13903
  service: 'git-receive-pack',
13894
13904
  url,
package/index.js CHANGED
@@ -395,7 +395,7 @@ class InternalError extends BaseError {
395
395
  */
396
396
  constructor(message) {
397
397
  super(
398
- `An internal error caused this command to fail.\n\nIf you're not a developer, report the bug to the developers of the application you're using. If this is a bug in isomorphic-git then you should create a proper bug yourselves. The bug should include a minimal reproduction and details about the version and environment.\n\nPlease file a bug report at https://github.com/isomorphic-git/isomorphic-git/issues with this error message: ${message}`
398
+ `An internal error caused this command to fail.\n\nIf you're using an application that depends on isomorphic-git, please report this error to that application's developers.\n\nIf you're a developer and you believe this is a bug in isomorphic-git, please file an issue at https://github.com/isomorphic-git/isomorphic-git/issues with a minimal reproduction, version and environment details, and this error message: ${message}`
399
399
  );
400
400
  this.code = this.name = InternalError.code;
401
401
  this.data = { message };
@@ -9318,6 +9318,16 @@ async function hasObject({
9318
9318
  return result
9319
9319
  }
9320
9320
 
9321
+ function addCredentialUsername({ config, onAuth }) {
9322
+ if (!onAuth) return onAuth
9323
+
9324
+ return async (url, auth) => {
9325
+ const username =
9326
+ auth.username || (await config.get(`credential.${url}.username`));
9327
+ return onAuth(url, username ? { ...auth, username } : auth)
9328
+ }
9329
+ }
9330
+
9321
9331
  // TODO: make a function that just returns obCount. then emptyPackfile = () => sizePack(pack) === 0
9322
9332
  function emptyPackfile(pack) {
9323
9333
  const pheader = '5041434b';
@@ -9337,8 +9347,8 @@ function filterCapabilities(server, client) {
9337
9347
 
9338
9348
  const pkg = {
9339
9349
  name: 'isomorphic-git',
9340
- version: '1.38.2',
9341
- agent: 'git/isomorphic-git@1.38.2',
9350
+ version: '1.38.4',
9351
+ agent: 'git/isomorphic-git@1.38.4',
9342
9352
  };
9343
9353
 
9344
9354
  class FIFO {
@@ -9752,9 +9762,9 @@ async function _fetch({
9752
9762
  const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url });
9753
9763
  const remoteHTTP = await GitRemoteHTTP.discover({
9754
9764
  http,
9755
- onAuth,
9765
+ onAuth: addCredentialUsername({ config, onAuth }),
9756
9766
  onAuthSuccess,
9757
- onAuthFailure,
9767
+ onAuthFailure: addCredentialUsername({ config, onAuth: onAuthFailure }),
9758
9768
  corsProxy,
9759
9769
  service: 'git-upload-pack',
9760
9770
  url,
@@ -13873,9 +13883,9 @@ async function _push({
13873
13883
  const GitRemoteHTTP = GitRemoteManager.getRemoteHelperFor({ url });
13874
13884
  const httpRemote = await GitRemoteHTTP.discover({
13875
13885
  http,
13876
- onAuth,
13886
+ onAuth: addCredentialUsername({ config, onAuth }),
13877
13887
  onAuthSuccess,
13878
- onAuthFailure,
13888
+ onAuthFailure: addCredentialUsername({ config, onAuth: onAuthFailure }),
13879
13889
  corsProxy,
13880
13890
  service: 'git-receive-pack',
13881
13891
  url,