From e709bc199fe33456c4ecd1cd28029bd31b529832 Mon Sep 17 00:00:00 2001 From: delvh Date: Mon, 2 Oct 2023 16:52:18 +0200 Subject: [PATCH] Differentiate between `push` and `pull` `mirror sync in progress` (#27390) Previously, if you had both a push and a pull mirror, the message did not clarify if you've accidentally synchronized the wrong one. Additionally fixed two typos that were encountered while debugging. ## Screenshots ![grafik](https://github.com/go-gitea/gitea/assets/51889757/164d5d20-728d-4365-9cb5-c37e95857cdf) ![grafik](https://github.com/go-gitea/gitea/assets/51889757/90bfffd2-abd4-4847-b8e2-db4231700a6d) --- options/locale/locale_en-US.ini | 3 ++- routers/web/repo/setting/setting.go | 4 ++-- services/mirror/mirror_pull.go | 4 ++-- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 7999757b83..ebd55f39be 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2009,7 +2009,8 @@ settings.mirror_settings.push_mirror.add = Add Push Mirror settings.mirror_settings.push_mirror.edit_sync_time = Edit mirror sync interval settings.sync_mirror = Synchronize Now -settings.mirror_sync_in_progress = Mirror synchronization is in progress. Check back in a minute. +settings.pull_mirror_sync_in_progress = Pulling changes from the remote %s at the moment. +settings.push_mirror_sync_in_progress = Pushing changes to the remote %s at the moment. settings.site = Website settings.update_settings = Update Settings settings.update_mirror_settings = Update Mirror Settings diff --git a/routers/web/repo/setting/setting.go b/routers/web/repo/setting/setting.go index 35c9098178..3cf58f308c 100644 --- a/routers/web/repo/setting/setting.go +++ b/routers/web/repo/setting/setting.go @@ -285,7 +285,7 @@ func SettingsPost(ctx *context.Context) { mirror_service.AddPullMirrorToQueue(repo.ID) - ctx.Flash.Info(ctx.Tr("repo.settings.mirror_sync_in_progress")) + ctx.Flash.Info(ctx.Tr("repo.settings.pull_mirror_sync_in_progress", repo.OriginalURL)) ctx.Redirect(repo.Link() + "/settings") case "push-mirror-sync": @@ -302,7 +302,7 @@ func SettingsPost(ctx *context.Context) { mirror_service.AddPushMirrorToQueue(m.ID) - ctx.Flash.Info(ctx.Tr("repo.settings.mirror_sync_in_progress")) + ctx.Flash.Info(ctx.Tr("repo.settings.push_mirror_sync_in_progress", m.RemoteAddress)) ctx.Redirect(repo.Link() + "/settings") case "push-mirror-update": diff --git a/services/mirror/mirror_pull.go b/services/mirror/mirror_pull.go index 38b6986c4a..d1f0391d7a 100644 --- a/services/mirror/mirror_pull.go +++ b/services/mirror/mirror_pull.go @@ -592,7 +592,7 @@ func checkAndUpdateEmptyRepository(m *repo_model.Mirror, gitRepo *git.Repository if err := gitRepo.SetDefaultBranch(m.Repo.DefaultBranch); err != nil { if !git.IsErrUnsupportedVersion(err) { log.Error("Failed to update default branch of underlying git repository %-v. Error: %v", m.Repo, err) - desc := fmt.Sprintf("Failed to uupdate default branch of underlying git repository '%s': %v", m.Repo.RepoPath(), err) + desc := fmt.Sprintf("Failed to update default branch of underlying git repository '%s': %v", m.Repo.RepoPath(), err) if err = system_model.CreateRepositoryNotice(desc); err != nil { log.Error("CreateRepositoryNotice: %v", err) } @@ -603,7 +603,7 @@ func checkAndUpdateEmptyRepository(m *repo_model.Mirror, gitRepo *git.Repository // Update the is empty and default_branch columns if err := repo_model.UpdateRepositoryCols(db.DefaultContext, m.Repo, "default_branch", "is_empty"); err != nil { log.Error("Failed to update default branch of repository %-v. Error: %v", m.Repo, err) - desc := fmt.Sprintf("Failed to uupdate default branch of repository '%s': %v", m.Repo.RepoPath(), err) + desc := fmt.Sprintf("Failed to update default branch of repository '%s': %v", m.Repo.RepoPath(), err) if err = system_model.CreateRepositoryNotice(desc); err != nil { log.Error("CreateRepositoryNotice: %v", err) }