forgejo/release-notes/8.0.0/fix
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
..
3363.md fix(Dockerfile.rootless): revert to default path for app.ini 2024-04-26 21:30:10 +02:00
3430.md docs(release-notes): split items in files to avoid conflicts (#3452) 2024-04-26 08:26:33 +00:00
3442.md docs(release-notes): split items in files to avoid conflicts (#3452) 2024-04-26 08:26:33 +00:00
3729.md [skip ci] docs(release-notes): 7.0.3 2024-05-22 12:34:50 +02:00
3922.md Update module github.com/alecthomas/chroma/v2 to v2.14.0 (take 2) 2024-05-30 22:52:26 +02:00
4026.md test(oauth): coverage for the redirection of a denied grant 2024-06-05 12:51:44 +02:00
4124.md Add release note 2024-06-13 10:29:23 +02:00
4145.md docs(release-notes): week 2024-25 cherry pick 2024-06-16 13:42:59 +02:00
4149.md fix(repository): git push to an adopted repository fails 2024-06-16 19:06:06 +02:00
4222.md Update module github.com/yuin/goldmark to v1.7.3 2024-06-24 08:03:18 +02:00
4240.md Update module github.com/yuin/goldmark to v1.7.4 2024-06-26 06:19:55 +00:00
4253.md fix(hook): ignore unknown push options instead of failing 2024-07-02 20:18:33 +00:00
4258.md ui: fix wrong string used in a search box (#4258) 2024-06-28 16:28:03 +00:00