gitea/services/pull
Jason Song 90982bffa5
Add force_merge to merge request and fix checking mergable (#23010) (#23032)
Backport #23010.

Fix #23000.

The bug was introduced in #22633, and it seems that it has been noticed:
https://github.com/go-gitea/gitea/pull/22633#discussion_r1095395359 .

However, #22633 did nothing wrong, the logic should be "check if they is
admin only when `force` is true".

So we should provide the `ForceMerge` when merging from UI.

After this, an admin can also send a normal merge request with
`ForceMerge` false. So it fixes a potential bug: if the admin doesn't
want to do a force merge, they just see the green "Merge" button and
click it. At the same time, the status of the PR changed, and it
shouldn't be merged now, so the admin could send an unexpected force
merge.

In addition, I updated `ForceMerge *bool` to `ForceMerge bool`, I don't
see the reason to use a pointer.

And fixed the logic of CheckPullMergable to handle auto merge and force
merge correctly.
2023-02-21 09:42:22 -06:00
..
check.go Add force_merge to merge request and fix checking mergable (#23010) (#23032) 2023-02-21 09:42:22 -06:00
check_test.go Refactor AssertExistsAndLoadBean to use generics (#20797) 2022-08-16 10:22:25 +08:00
commit_status.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
edits.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
lfs.go Move issues related files into models/issues (#19931) 2022-06-13 17:37:59 +08:00
main_test.go Use a struct as test options (#19393) 2022-04-14 21:58:21 +08:00
merge.go Use `--message=%s` for git commit message (#23028) (#23029) 2023-02-21 14:16:25 +08:00
patch.go Improve trace logging for pulls and processes (#22633) (#22812) 2023-02-13 11:17:36 +08:00
patch_unmerged.go Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2022-10-24 20:29:17 +01:00
pull.go some refactor about code comments(#20821) (#22707) 2023-02-16 21:21:25 +08:00
pull_test.go Refactor AssertExistsAndLoadBean to use generics (#20797) 2022-08-16 10:22:25 +08:00
review.go some refactor about code comments(#20821) (#22707) 2023-02-16 21:21:25 +08:00
temp_repo.go Use complete SHA to create and query commit status (#22244) (#22257) 2022-12-28 11:03:21 +01:00
update.go Fix 500 error viewing pull request when fork has pull requests disabled (#22512) (#22515) 2023-01-18 22:50:51 +01:00