forgejo/release-notes/8.0.0
Twenty Panda 0d09acf669 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
(cherry picked from commit 5561e80b04)
2024-07-02 20:18:33 +00:00
..
feat docs(release-notes): week 2024-27 cherry pick 2024-07-02 09:02:33 +00:00
fix fix(hook): ignore unknown push options instead of failing 2024-07-02 20:18:33 +00:00
perf docs(release-notes): week 2024-25 cherry pick 2024-06-16 13:42:59 +02:00
3139.md Add release note for #3139 2024-04-28 22:44:59 +02:00
3285.md Add a release note for #3285 2024-05-10 09:32:07 +02:00
3334.md Add support for workflow_dispatch (#3334) 2024-06-28 05:17:11 +00:00
3383.md Release notes for Limit database max connections by default 2024-04-27 22:03:25 +02:00
3414.md ldap: default domain name (#3414) 2024-04-26 22:38:58 +00:00
3616.md Add slogan config (#3752) 2024-06-07 17:12:48 +00:00
3724.md Update module github.com/caddyserver/certmagic to v0.21.0 (#3724) 2024-05-12 14:56:39 +00:00
3811.md Add minimal implementation for RubyGems compact index API. (#3811) 2024-05-19 23:30:41 +00:00
3830.md fix(actions): prevent deleted records' UUID from colliding with new records (#3830) 2024-05-19 10:46:15 +00:00
3934.md Add a release note about the previous changes 2024-05-31 08:21:55 +02:00
4095.md Disable issue subscribe button for guest users (#4095) 2024-06-11 05:54:35 +00:00
4139.md Reorder repo tabs (#4139) 2024-06-16 12:36:41 +00:00
4189.md Better logic for showing user feed/public activity elements (#4189) 2024-06-24 08:19:11 +00:00
4201.md Clarify author label in tooltip 2024-06-25 18:30:06 +05:00