Skip to content

Commit

Permalink
improve
Browse files Browse the repository at this point in the history
  • Loading branch information
lunny committed Nov 5, 2019
1 parent fd18427 commit 437e90d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions routers/api/v1/repo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -465,14 +465,13 @@ func Migrate(ctx *context.APIContext, form auth.MigrateRepoForm) {
}
}()

_, err = migrations.MigrateRepository(ctx.User, ctxUser.Name, opts)
if err == nil {
log.Trace("Repository migrated: %s/%s", ctxUser.Name, form.RepoName)
ctx.JSON(201, repo.APIFormat(models.AccessModeAdmin))
if _, err = migrations.MigrateRepository(ctx.User, ctxUser.Name, opts); err != nil {
handleMigrateError(ctx, remoteAddr, err)
return
}

handleMigrateError(ctx, remoteAddr, err)
log.Trace("Repository migrated: %s/%s", ctxUser.Name, form.RepoName)
ctx.JSON(201, repo.APIFormat(models.AccessModeAdmin))
}

func handleMigrateError(ctx *context.APIContext, remoteAddr string, err error) {
Expand Down

0 comments on commit 437e90d

Please sign in to comment.