-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Disable custom Git Hooks globally via configuration file #2450
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -124,6 +124,7 @@ var ( | |
ReverseProxyAuthUser string | ||
MinPasswordLength int | ||
ImportLocalPaths bool | ||
DisableGitHooks bool | ||
|
||
// Database settings | ||
UseSQLite3 bool | ||
|
@@ -817,6 +818,7 @@ func NewContext() { | |
ReverseProxyAuthUser = sec.Key("REVERSE_PROXY_AUTHENTICATION_USER").MustString("X-WEBAUTH-USER") | ||
MinPasswordLength = sec.Key("MIN_PASSWORD_LENGTH").MustInt(6) | ||
ImportLocalPaths = sec.Key("IMPORT_LOCAL_PATHS").MustBool(false) | ||
DisableGitHooks = sec.Key("DISABLE_GIT_HOOKS").MustBool(false) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add this also to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JonasFranzDEV Thanks for this feedback. I've just pushed a new commit with the option in |
||
InternalToken = sec.Key("INTERNAL_TOKEN").String() | ||
if len(InternalToken) == 0 { | ||
secretBytes := make([]byte, 32) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,7 @@ | |
<div class="inline field"> | ||
<div class="ui checkbox"> | ||
<label><strong>{{.i18n.Tr "admin.users.allow_git_hook"}}</strong></label> | ||
<input name="allow_git_hook" type="checkbox" {{if .User.CanEditGitHook}}checked{{end}}> | ||
<input name="allow_git_hook" type="checkbox" {{if .User.CanEditGitHook}}checked{{end}} {{if DisableGitHooks}}disabled{{end}}> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since https://github.com/go-gitea/gitea/pull/2450/files#diff-46259196476f860fea33754fcb22e9eeR240 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the review @bkcsoft. This change is needed so that an admin doesn't get confused. If the global setting is set to disable githooks, then the template change will prevent the admin from checking the box in the admin dashboard and wondering why the change doesn't take effect. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. aah right, missed the "disabled" part :) |
||
</div> | ||
</div> | ||
<div class="inline field"> | ||
|
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.
Thanks for this feedback, especially linking me to where I could look. Investigating this (by calling the API to see what the response would be), I found that it only returns the standard gitea/slack/discord/etc.. hooks, and couldn't find it returning the githooks.