summaryrefslogtreecommitdiffstats
path: root/modules
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-09-16 14:34:54 +0100
committerGitHub <noreply@github.com>2021-09-16 15:34:54 +0200
commit8de44d1995e73ec139ede5626466af1fce8c571a (patch)
tree1d47dbb69c70e2716785e804c39fcf59ba701559 /modules
parenta959ed99c2966dfc10ac41710eb74b7baf490bcf (diff)
downloadgitea-8de44d1995e73ec139ede5626466af1fce8c571a.tar.gz
gitea-8de44d1995e73ec139ede5626466af1fce8c571a.zip
Clean-up HookPreReceive and restore functionality for pushing non-standard refs (#16705)
* Clean-up HookPreReceive and restore functionality for pushing non-standard refs There was an inadvertent breaking change in #15629 meaning that notes refs and other git extension refs will be automatically rejected. Further following #14295 and #15629 the pre-recieve hook code is untenably long and too complex. This PR refactors the hook code and removes the incorrect forced rejection of non-standard refs. Fix #16688 Signed-off-by: Andrew Thornton <art27@cantab.net>
Diffstat (limited to 'modules')
-rw-r--r--modules/web/route.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/modules/web/route.go b/modules/web/route.go
index 3c6513da62..9b08510264 100644
--- a/modules/web/route.go
+++ b/modules/web/route.go
@@ -31,6 +31,7 @@ func Wrap(handlers ...interface{}) http.HandlerFunc {
func(ctx *context.Context) goctx.CancelFunc,
func(*context.APIContext),
func(*context.PrivateContext),
+ func(*context.PrivateContext) goctx.CancelFunc,
func(http.Handler) http.Handler:
default:
panic(fmt.Sprintf("Unsupported handler type: %#v", t))
@@ -59,6 +60,15 @@ func Wrap(handlers ...interface{}) http.HandlerFunc {
if ctx.Written() {
return
}
+ case func(*context.PrivateContext) goctx.CancelFunc:
+ ctx := context.GetPrivateContext(req)
+ cancel := t(ctx)
+ if cancel != nil {
+ defer cancel()
+ }
+ if ctx.Written() {
+ return
+ }
case func(ctx *context.Context):
ctx := context.GetContext(req)
t(ctx)