From f1cfd152e2cb47680d2af1a71e2b4fc8aa18ca0d Mon Sep 17 00:00:00 2001 From: Gusted Date: Sun, 10 Aug 2025 14:26:07 +0200 Subject: [PATCH] feat: update broken git hook error (#8820) - The "Git hooks of this repository seem to be broken" error is currently shown if for whatever reason the database doesn't agree with Git on what the commitID for a branch is. This can happen for a variety of reasons, but usually is just a transient error. - Saying that the git hooks of the repository "looks broken" is very likely to be correct in some contexts, but I have not yet seen that case and in those cases; other stuff would also be broken and would indicate that Forgejo is not functioning correctly. - Replace this warning with a more helpful message that contains a easy fix that works in the cases where it was a transient error - push another commit (so the git hooks get run again). If the warning persists contact the instance admins and they will figure out the git hooks are broken or contact Forgejo about this problem. - Moreover removes a link to Gitea documentation. - A potential improvement (if people will run into this problem, and we then know what they ran into), we could show a specific warning to instance admins that contains troubleshooting steps or point to our own documentation. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8820 Reviewed-by: oliverpool Co-authored-by: Gusted Co-committed-by: Gusted --- options/locale/locale_en-US.ini | 1 - options/locale_next/locale_en-US.json | 1 + routers/web/repo/view.go | 2 +- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 391d3d06f0..bfc657540b 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2851,7 +2851,6 @@ find_file.no_matching = No matching file found error.csv.too_large = Can't render this file because it is too large. error.csv.unexpected = Can't render this file because it contains an unexpected character in line %d and column %d. error.csv.invalid_field_count = Can't render this file because it has a wrong number of fields in line %d. -error.broken_git_hook = Git hooks of this repository seem to be broken. Please follow the documentation to fix them, then push some commits to refresh the status. [repo.permissions] code.read = Read: Access and clone the code of the repository. diff --git a/options/locale_next/locale_en-US.json b/options/locale_next/locale_en-US.json index aa8d811bd3..5d489a167a 100644 --- a/options/locale_next/locale_en-US.json +++ b/options/locale_next/locale_en-US.json @@ -62,6 +62,7 @@ "themes.names.forgejo-light": "Forgejo light", "themes.names.forgejo-dark": "Forgejo dark", "error.not_found.title": "Page not found", + "warning.repository.out_of_sync": "The database representation of this repository is out of synchronization. If this warning is still shown after pushing a commit to this repository contact the administrator.", "alert.asset_load_failed": "Failed to load asset files from {path}. Please make sure the asset files can be accessed.", "alert.range_error": " must be a number between %[1]s and %[2]s.", "install.invalid_lfs_path": "Unable to create the LFS root at the specified path: %[1]s", diff --git a/routers/web/repo/view.go b/routers/web/repo/view.go index f317f1e549..cd0af75b8f 100644 --- a/routers/web/repo/view.go +++ b/routers/web/repo/view.go @@ -1221,7 +1221,7 @@ func checkOutdatedBranch(ctx *context.Context) { } if dbBranch.CommitID != commit.ID.String() { - ctx.Flash.Warning(ctx.Tr("repo.error.broken_git_hook", "https://docs.gitea.com/help/faq#push-hook--webhook--actions-arent-running"), true) + ctx.Flash.Warning(ctx.Tr("warning.repository.out_of_sync"), true) } }