forgejo/routers/private
Twenty Panda 5561e80b04 fix(hook): ignore unknown push options instead of failing
If a repository has

git config --add push.pushOption submit=".sourcehut/*.yml"

it failed when pushed because of the unknown submit push
option. It will be ignored instead.

Filtering out the push options is done in an earlier stage, when the
hook command runs, before it submits the options map to the private
endpoint.

* move all the push options logic to modules/git/pushoptions
* add 100% test coverage for modules/git/pushoptions

Test coverage for the code paths from which code was moved to the
modules/git/pushoptions package:

* cmd/hook.go:runHookPreReceive
* routers/private/hook_pre_receive.go:validatePushOptions
  tests/integration/git_push_test.go:TestOptionsGitPush runs through
  both. The test verifying the option is rejected was removed and, if
  added again, will fail because the option is now ignored instead of
  being rejected.

* cmd/hook.go:runHookProcReceive
* services/agit/agit.go:ProcReceive
  tests/integration/git_test.go: doCreateAgitFlowPull runs through
  both. It uses variations of AGit related push options.

* cmd/hook.go:runHookPostReceive
* routers/private/hook_post_receive.go:HookPostReceive
  tests/integration/git_test.go:doPushCreate called by TestGit/HTTP/sha1/PushCreate
  runs through both.
  Note that although it provides coverage for this code path it does not use push options.

Fixes: https://codeberg.org/forgejo/forgejo/issues/3651
2024-07-02 21:39:01 +02:00
..
tests/repos
actions.go Clean up log messages (#30313) 2024-04-15 20:01:35 +02:00
default_branch.go
hook_post_receive.go fix(hook): ignore unknown push options instead of failing 2024-07-02 21:39:01 +02:00
hook_post_receive_test.go Move database operations of merging a pull request to post receive hook and add a transaction (#30805) 2024-05-12 20:03:10 +02:00
hook_pre_receive.go fix(hook): ignore unknown push options instead of failing 2024-07-02 21:39:01 +02:00
hook_proc_receive.go
hook_verification.go Clean up log messages (#30313) 2024-04-15 20:01:35 +02:00
hook_verification_test.go
internal.go
internal_repo.go
key.go
mail.go Clean up log messages (#30313) 2024-04-15 20:01:35 +02:00
main_test.go
manager.go
manager_process.go
manager_unix.go
manager_windows.go
restore_repo.go
serv.go
ssh_log.go