diff options
author | Unknwon <u@gogs.io> | 2015-12-08 20:06:12 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2015-12-08 20:06:12 -0500 |
commit | 120cd4e4716d11f79a7e8c41c066383e579d480a (patch) | |
tree | b25ae1b31ecf5437250c388d55ee940e294a4187 /routers | |
parent | 1cbd4c01fbfd4e15e36a722c9e2cc19366be3df8 (diff) | |
download | gitea-120cd4e4716d11f79a7e8c41c066383e579d480a.tar.gz gitea-120cd4e4716d11f79a7e8c41c066383e579d480a.zip |
#1984 Better mirror repo management
Diffstat (limited to 'routers')
-rw-r--r-- | routers/api/v1/repo/repo.go | 2 | ||||
-rw-r--r-- | routers/install.go | 3 | ||||
-rw-r--r-- | routers/repo/repo.go | 6 | ||||
-rw-r--r-- | routers/repo/setting.go | 7 |
4 files changed, 12 insertions, 6 deletions
diff --git a/routers/api/v1/repo/repo.go b/routers/api/v1/repo/repo.go index 864cb4dd17..c0d897b5d4 100644 --- a/routers/api/v1/repo/repo.go +++ b/routers/api/v1/repo/repo.go @@ -234,7 +234,7 @@ func Migrate(ctx *middleware.Context, form auth.MigrateRepoForm) { log.Error(4, "DeleteRepository: %v", errDelete) } } - ctx.APIError(500, "MigrateRepository", err) + ctx.APIError(500, "MigrateRepository", models.HandleCloneUserCredentials(err.Error(), true)) return } diff --git a/routers/install.go b/routers/install.go index c47df0a54a..6d2296cfc9 100644 --- a/routers/install.go +++ b/routers/install.go @@ -41,7 +41,8 @@ func checkRunMode() { macaron.Env = macaron.PROD macaron.ColorLog = false setting.ProdMode = true - git.Debug = false + default: + git.Debug = true } log.Info("Run Mode: %s", strings.Title(macaron.Env)) } diff --git a/routers/repo/repo.go b/routers/repo/repo.go index f930c132d2..7cc7df35a2 100644 --- a/routers/repo/repo.go +++ b/routers/repo/repo.go @@ -192,7 +192,7 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { RemoteAddr: remoteAddr, }) if err == nil { - log.Trace("Repository migrated[%d]: %s/%s", repo.ID, ctxUser.Name, form.RepoName) + log.Trace("Repository migrated [%d]: %s/%s", repo.ID, ctxUser.Name, form.RepoName) ctx.Redirect(setting.AppSubUrl + "/" + ctxUser.Name + "/" + form.RepoName) return } @@ -206,11 +206,11 @@ func MigratePost(ctx *middleware.Context, form auth.MigrateRepoForm) { if strings.Contains(err.Error(), "Authentication failed") || strings.Contains(err.Error(), "could not read Username") { ctx.Data["Err_Auth"] = true - ctx.RenderWithErr(ctx.Tr("form.auth_failed", strings.Replace(err.Error(), ":"+form.AuthPassword+"@", ":<password>@", 1)), MIGRATE, &form) + ctx.RenderWithErr(ctx.Tr("form.auth_failed", models.HandleCloneUserCredentials(err.Error(), true)), MIGRATE, &form) return } else if strings.Contains(err.Error(), "fatal:") { ctx.Data["Err_CloneAddr"] = true - ctx.RenderWithErr(ctx.Tr("repo.migrate.failed", strings.Replace(err.Error(), ":"+form.AuthPassword+"@", ":<password>@", 1)), MIGRATE, &form) + ctx.RenderWithErr(ctx.Tr("repo.migrate.failed", models.HandleCloneUserCredentials(err.Error(), true)), MIGRATE, &form) return } diff --git a/routers/repo/setting.go b/routers/repo/setting.go index beda715c18..e4c4f897a0 100644 --- a/routers/repo/setting.go +++ b/routers/repo/setting.go @@ -109,9 +109,14 @@ func SettingsPost(ctx *middleware.Context, form auth.RepoSettingForm) { ctx.Repo.Mirror.Interval = form.Interval ctx.Repo.Mirror.NextUpdate = time.Now().Add(time.Duration(form.Interval) * time.Hour) if err := models.UpdateMirror(ctx.Repo.Mirror); err != nil { - log.Error(4, "UpdateMirror: %v", err) + ctx.Handle(500, "UpdateMirror", err) + return } } + if err := ctx.Repo.Mirror.SaveAddress(form.MirrorAddress); err != nil { + ctx.Handle(500, "SaveAddress", err) + return + } } ctx.Flash.Success(ctx.Tr("repo.settings.update_settings_success")) |