Skip to content

"default_delete_branch_after_merge"cannot be updated via API #36466

@matthiashinrichs

Description

@matthiashinrichs

Description

Updating a repository's default_delete_branch_after_merge property via the PATCH API endpoint does not persist the change, even though the API returns a 200 OK status.

Reproduction Steps:

  1. Identify a repository (e.g., hnrx/test).
  2. Send a PATCH request to /api/v1/repos/hnrx/test with the following payload:
    { "default_delete_branch_after_merge": true }
  3. The response is HTTP 200 OK and includes the full repository JSON object.
  4. Observe that in the response JSON, "default_delete_branch_after_merge" is still false.
  5. Check the Web UI settings for the repository; the option remains disabled.

Additional Context:

  • Other properties (like name or description) can be successfully updated using the same PATCH call.
  • The issue persists regardless of whether ALLOW_KEEP_PULL_REQUEST_HEAD_BRANCH is explicitly set in the app.ini or not.
  • Testing via the built-in Swagger UI produces the same incorrect behavior.
  • Manual update via Web UI works: Setting the "Delete branch after merge" option manually in the repository settings via the web interface works perfectly and persists as expected. The issue is strictly limited to the API PATCH method.

Expected behavior: The property should be updated to true in the database and reflected in the API response and Web UI.

Gitea Version

1.25.4

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?

official docker container

Database

SQLite

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