From 0ae59b7de7b76f1a2261d80e66db5178af45d479 Mon Sep 17 00:00:00 2001 From: Gusted Date: Fri, 31 Jan 2025 11:28:09 +0100 Subject: [PATCH] chore: Remove `ParseCreateHook` - Introduced in e378648c79489e0e65e0a4e1a1b3e0b1ad1f554f and removed in the same commit. No usage. --- .deadcode-out | 1 - modules/structs/hook.go | 20 -------------------- 2 files changed, 21 deletions(-) diff --git a/.deadcode-out b/.deadcode-out index 403aa87743..3e3bd9968b 100644 --- a/.deadcode-out +++ b/.deadcode-out @@ -199,7 +199,6 @@ code.gitea.io/gitea/modules/setting InitLoggersForTest code.gitea.io/gitea/modules/structs - ParseCreateHook ParsePushHook code.gitea.io/gitea/modules/sync diff --git a/modules/structs/hook.go b/modules/structs/hook.go index a41e172253..b3fdeb7f17 100644 --- a/modules/structs/hook.go +++ b/modules/structs/hook.go @@ -141,26 +141,6 @@ func (p *CreatePayload) JSONPayload() ([]byte, error) { return json.MarshalIndent(p, "", " ") } -// ParseCreateHook parses create event hook content. -func ParseCreateHook(raw []byte) (*CreatePayload, error) { - hook := new(CreatePayload) - if err := json.Unmarshal(raw, hook); err != nil { - return nil, err - } - - // it is possible the JSON was parsed, however, - // was not from Gogs (maybe was from Bitbucket) - // So we'll check to be sure certain key fields - // were populated - switch { - case hook.Repo == nil: - return nil, ErrInvalidReceiveHook - case len(hook.Ref) == 0: - return nil, ErrInvalidReceiveHook - } - return hook, nil -} - // ________ .__ __ // \______ \ ____ | | _____/ |_ ____ // | | \_/ __ \| | _/ __ \ __\/ __ \