@@ -436,7 +436,7 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
436
436
Status : models .RepositoryBeingMigrated ,
437
437
})
438
438
if err != nil {
439
- handleMigrateError (ctx , remoteAddr , err )
439
+ handleMigrateError (ctx , ctxUser , remoteAddr , err )
440
440
return
441
441
}
442
442
@@ -466,15 +466,15 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
466
466
}()
467
467
468
468
if _ , err = migrations .MigrateRepository (ctx .User , ctxUser .Name , opts ); err != nil {
469
- handleMigrateError (ctx , remoteAddr , err )
469
+ handleMigrateError (ctx , ctxUser , remoteAddr , err )
470
470
return
471
471
}
472
472
473
473
log .Trace ("Repository migrated: %s/%s" , ctxUser .Name , form .RepoName )
474
474
ctx .JSON (201 , repo .APIFormat (models .AccessModeAdmin ))
475
475
}
476
476
477
- func handleMigrateError (ctx * context.APIContext , remoteAddr string , err error ) {
477
+ func handleMigrateError (ctx * context.APIContext , repoOwner * models. User , remoteAddr string , err error ) {
478
478
switch {
479
479
case models .IsErrRepoAlreadyExist (err ):
480
480
ctx .Error (409 , "" , "The repository with the same name already exists." )
@@ -483,7 +483,7 @@ func handleMigrateError(ctx *context.APIContext, remoteAddr string, err error) {
483
483
case migrations .IsTwoFactorAuthError (err ):
484
484
ctx .Error (422 , "" , "Remote visit required two factors authentication." )
485
485
case models .IsErrReachLimitOfRepo (err ):
486
- ctx .Error (422 , "" , fmt .Sprintf ("You have already reached your limit of %d repositories." , ctx . User .MaxCreationLimit ()))
486
+ ctx .Error (422 , "" , fmt .Sprintf ("You have already reached your limit of %d repositories." , repoOwner .MaxCreationLimit ()))
487
487
case models .IsErrNameReserved (err ):
488
488
ctx .Error (422 , "" , fmt .Sprintf ("The username '%s' is reserved." , err .(models.ErrNameReserved ).Name ))
489
489
case models .IsErrNamePatternNotAllowed (err ):
0 commit comments