Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

default_delete_branch_after_merge doesn't work #19069

Closed
sprnza opened this issue Mar 13, 2022 · 2 comments · Fixed by #21130
Closed

default_delete_branch_after_merge doesn't work #19069

sprnza opened this issue Mar 13, 2022 · 2 comments · Fixed by #21130
Labels
modifies/api This PR adds API routes or modifies them type/bug

Comments

@sprnza
Copy link

sprnza commented Mar 13, 2022

Gitea Version

1.16.0

Git Version

2.30.2

Operating System

Debian 10

How are you running Gitea?

Gitea is running from docker container

Database

PostgreSQL

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Description

I've set default_delete_branch_after_merge to True using this:

http --auth user:pass PATCH https://try.gitea.io/api/v1/repos/user/TestRepo default_delete_branch_after_merge:=true

got this reply:

HTTP/1.1 200 OK

But when I create a PR a get checkbox "Delete branch 'test-branch' unchecked in UI and after merge the branch is not being deleted (so it's not just an UI issue).

Screenshots

No response

@noerw
Copy link
Member

noerw commented Mar 22, 2022

Looking at the code, I think you also need to set "has_pull_requests": true for changes to PR settings to have an effect:

if *opts.HasPullRequests && !unit_model.TypePullRequests.UnitGlobalDisabled() {

This doesn't seem like correct behavior to me, though changing this may be a breaking change to some.

@jolheiser
Copy link
Member

Parent issue #13622

6543 added a commit that referenced this issue Sep 27, 2022
This PR would presumably
Fix #20522
Fix #18773
Fix #19069
Fix #21077

Fix #13622

-----

1. Check whether unit type is currently enabled
2. Check if it _will_ be enabled via opt
3. Allow modification as necessary


Signed-off-by: jolheiser <john.olheiser@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
modifies/api This PR adds API routes or modifies them type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants