You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
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.
2 years ago
..
check.go Add force_merge to merge request and fix checking mergable (#23010) (#23032) 2 years ago
check_test.go Refactor AssertExistsAndLoadBean to use generics (#20797) 3 years ago
commit_status.go Move issues related files into models/issues (#19931) 3 years ago
edits.go Move issues related files into models/issues (#19931) 3 years ago
lfs.go Move issues related files into models/issues (#19931) 3 years ago
main_test.go Use a struct as test options (#19393) 3 years ago
merge.go Use `--message=%s` for git commit message (#23028) (#23029) 2 years ago
patch.go Improve trace logging for pulls and processes (#22633) (#22812) 2 years ago
patch_unmerged.go Replace all instances of fmt.Errorf(%v) with fmt.Errorf(%w) (#21551) 2 years ago
pull.go some refactor about code comments(#20821) (#22707) 2 years ago
pull_test.go Refactor AssertExistsAndLoadBean to use generics (#20797) 3 years ago
review.go some refactor about code comments(#20821) (#22707) 2 years ago
temp_repo.go Use complete SHA to create and query commit status (#22244) (#22257) 2 years ago
update.go Fix 500 error viewing pull request when fork has pull requests disabled (#22512) (#22515) 2 years ago