mirror of
				https://github.com/go-gitea/gitea.git
				synced 2025-10-26 12:27:06 +00:00 
			
		
		
		
	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>
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user