diff --git a/internal/gitaly/service/operations/update_with_hooks.go b/internal/gitaly/service/operations/update_with_hooks.go index ba90634bc46eceff5bac37ae99b53a8ea36c0851..615f8217eb119a9e4fa3385dae5abe49cf3807fc 100644 --- a/internal/gitaly/service/operations/update_with_hooks.go +++ b/internal/gitaly/service/operations/update_with_hooks.go @@ -62,6 +62,10 @@ func (s *Server) updateReferenceWithHooks(ctx context.Context, repo *gitalypb.Re changes := fmt.Sprintf("%s %s %s\n", oldrev, newrev, reference) var stdout, stderr bytes.Buffer + if s.hookManager == nil { + // See https://gitlab.com/gitlab-org/gitaly/-/merge_requests/2911#note_468836913 + panic("The hookManager must be set up already! Did you migrate non-hook-supporting code from Ruby to Go?") + } if err := s.hookManager.PreReceiveHook(ctx, repo, env, strings.NewReader(changes), &stdout, &stderr); err != nil { msg := hookErrorFromStdoutAndStderr(stdout.String(), stderr.String()) return preReceiveError{message: msg}