Skip to content

Protected branch deleted after merge when “Delete pull request branch after merge by default” is enabled #36812

@0xFiro

Description

@0xFiro

Description

Actual behavior

In a repository we enabled the setting “Delete pull request branch after merge by default”.
Additionally, the branch stage is protected.

After merging a PR from stage -> prod, the protected source branch stage was deleted automatically.

Expected behavior

Protected branches (e.g. stage) should never be deleted by auto-delete after merge.
Only non-protected PR source branches should be deleted (and only when the PR option/setting applies).

Steps to reproduce

  1. Create branches prod and stage
  2. Protect stage (branch protection enabled)
  3. Enable repo setting “Delete pull request branch after merge by default”
  4. Create PR stage -> prod
  5. Merge PR
  6. Observe: stage branch gets deleted

Gitea Version

1.25.2

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

we are hosting gitea on our server via docker.

Database

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions