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 <oliverpool@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
This commit is contained in:
Gusted 2025-08-10 14:26:07 +02:00 committed by Earl Warren
commit f1cfd152e2
3 changed files with 2 additions and 2 deletions

View file

@ -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 <a target="_blank" rel="noreferrer" href="%s">documentation</a> to fix them, then push some commits to refresh the status.
[repo.permissions]
code.read = <b>Read:</b> Access and clone the code of the repository.

View file

@ -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",

View file

@ -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)
}
}