-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Detect broken git hooks #29494
Detect broken git hooks #29494
Conversation
options/locale/locale_en-US.ini
Outdated
@@ -2591,6 +2591,7 @@ 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="https://docs.gitea.com/help/faq#push-hook--webhook-arent-running">documentation</a> to fix them, then push some commits to refresh the status. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd prefer including the link as translation parameter instead of hardcoded, i.e. to be able to easily change it when the link changes, and to prevent translation errors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, there is a longstanding problem: non-English translation would (might) NEVER be updated ....
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
-> #29500
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can leave it to #29500, and follow the current way of other translations for now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about 452afc2.
Why "Please follow the <a target="_blank" rel="noreferrer" href="%s">documentation</a>
to fix them" instead of:
- "Please follow the
%s
to fix them": it has missed the word "documentation". - "Please follow the
%[1]sdocumentation%[2]s
to fix them": it could be very difficult for translators to understand what it is unless they have read the code.
@@ -1072,6 +1074,27 @@ func renderHomeCode(ctx *context.Context) { | |||
ctx.HTML(http.StatusOK, tplRepoHome) | |||
} | |||
|
|||
func checkOutdatedBranch(ctx *context.Context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
checkGitHooksAreWorking
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure, since it can only say "git hooks seem to be broken", it's also possible for other reasons to cause outdated branches.
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
depends on #29493
Unlike other async processing in the queue, we should sync branches to the DB immediately when handling git hook calling. If it fails, users can see the error message in the output of the git command. It can avoid potential inconsistency issues, and help #29494. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* origin/main: (29 commits) Tweak actions color and borders (go-gitea#29640) Add download URL for executable files (go-gitea#28260) Move all login and account creation page labels to be above inputs (go-gitea#29432) Avoid issue info panic (go-gitea#29625) Cache repository default branch commit status to reduce query on commit status table (go-gitea#29444) Avoid unexpected panic in graceful manager (go-gitea#29629) Add a link for the recently pushed branch notification (go-gitea#29627) Fix wrong header of org project view page (go-gitea#29626) Detect broken git hooks (go-gitea#29494) Sync branches to DB immediately when handle git hook calling (go-gitea#29493) Fix wrong line number in code search result (go-gitea#29260) Make wiki default branch name changable (go-gitea#29603) A small refactor for agit implementation (go-gitea#29614) Update Twitter Logo (go-gitea#29621) Fix 500 error when adding PR comment (go-gitea#29622) Run editorconfig-checker on `locale_en-US.ini` (go-gitea#29608) bump protobuf module (go-gitea#29617) Add ac claim for old docker/build-push-action@v3 / current buildx gha cache (go-gitea#29584) Skip email domain check when admins edit user emails (go-gitea#29609) Improve natural sort (go-gitea#29611) ...
* giteaofficial/main: Use strict protocol check when redirect (go-gitea#29642) Update various logos and unify their filenames (go-gitea#29637) Tweak actions color and borders (go-gitea#29640) Add download URL for executable files (go-gitea#28260) Move all login and account creation page labels to be above inputs (go-gitea#29432) Avoid issue info panic (go-gitea#29625) Cache repository default branch commit status to reduce query on commit status table (go-gitea#29444) Avoid unexpected panic in graceful manager (go-gitea#29629) Add a link for the recently pushed branch notification (go-gitea#29627) Fix wrong header of org project view page (go-gitea#29626) Detect broken git hooks (go-gitea#29494) Sync branches to DB immediately when handle git hook calling (go-gitea#29493) Fix wrong line number in code search result (go-gitea#29260) Make wiki default branch name changable (go-gitea#29603) A small refactor for agit implementation (go-gitea#29614) Update Twitter Logo (go-gitea#29621) Fix 500 error when adding PR comment (go-gitea#29622)
The warning message maybe not good enough. |
Detect broken git hooks by checking if the commit id of branches in DB is the same with the git repo.
It can help #29338 #28277 and maybe more issues.
Users could complain about actions, webhooks, and activities not working, but they were not aware that it is caused by broken git hooks unless they could see a warning.
It should be merged after #29493. Otherwise, users could see a ephemeral warning after committing and opening the repo home page immediately.
And it also waits for #29495, since the doc link (the anchor part) will be updated.