From 1b10046e1ad20e9ee0a482b4b45edd69e745e58c Mon Sep 17 00:00:00 2001 From: Gusted Date: Fri, 31 Jan 2025 11:28:54 +0100 Subject: [PATCH] chore: Remove `ParsePushHook` - Introduced in e378648c79489e0e65e0a4e1a1b3e0b1ad1f554f and removed in the same commit. No usage. --- .deadcode-out | 3 --- modules/structs/hook.go | 16 ---------------- 2 files changed, 19 deletions(-) diff --git a/.deadcode-out b/.deadcode-out index 3e3bd9968b..811b093fe9 100644 --- a/.deadcode-out +++ b/.deadcode-out @@ -198,9 +198,6 @@ code.gitea.io/gitea/modules/setting GitConfigType.GetOption InitLoggersForTest -code.gitea.io/gitea/modules/structs - ParsePushHook - code.gitea.io/gitea/modules/sync StatusTable.Start StatusTable.IsRunning diff --git a/modules/structs/hook.go b/modules/structs/hook.go index b3fdeb7f17..10b3a9db9b 100644 --- a/modules/structs/hook.go +++ b/modules/structs/hook.go @@ -272,22 +272,6 @@ func (p *PushPayload) JSONPayload() ([]byte, error) { return json.MarshalIndent(p, "", " ") } -// ParsePushHook parses push event hook content. -func ParsePushHook(raw []byte) (*PushPayload, error) { - hook := new(PushPayload) - if err := json.Unmarshal(raw, hook); err != nil { - return nil, err - } - - switch { - case hook.Repo == nil: - return nil, ErrInvalidReceiveHook - case len(hook.Ref) == 0: - return nil, ErrInvalidReceiveHook - } - return hook, nil -} - // Branch returns branch name from a payload func (p *PushPayload) Branch() string { return strings.ReplaceAll(p.Ref, "refs/heads/", "")