Skip to content

Gitea incorrectly auto-closes issue even though referenced branch has not been merged yet #33929

@reimer-atb

Description

@reimer-atb

Description

Gitea incorrectly auto-closes an issue if you force-push to a PR referencing that issue, even though the PR is still open and not merged into the main branch.

Steps to reproduce

  1. Create a repo with a single file README.md.

  2. Create issue "A" in that repo

  3. Create a new branch "<issue_number>-A" for the issue, add some changes to README.md, commit them with message "closes #<issue_number>" to enable auto-close when the branch is merged, and push it

  4. Create a pull request based on branch "<issue_number>-A" above

  5. Link the issue to the pull request branch "<issue_number>-A"

    Image

  6. Create a second branch "B" based on "main", add a change to README.md that conflicts with a change in branch "<issue_number>-A", and push it

  7. Create a pull request for the second branch "B", and merge it using "Rebase
    then fast-forward" and selecting "Delete Branch "B""

  8. Pull the updated "main" branch locally, switch to branch "<issue_number>-A", and run git rebase main

  9. Resolve the conflict in README.md keeping both changes, and run git add README.md, then git rebase --continue

  10. Run git push --force-with-lease

Result

Issue "A" is auto-closed (see https://demo.gitea.com/reimer-atb/test/issues/1)

Image

even though the PR is still open and branch "<issue_number>-A" has not been merged into "main" (see https://demo.gitea.com/reimer-atb/test/pulls/2).

Image

Expected result

Issue "A" should remain "open". It should only be auto-closed when the PR is merged into "main".

Gitea Version

1.23.5 and 1.24.0+dev-424-g403775e74e

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

2.49.0

Operating System

No response

How are you running Gitea?

I used demo.gitea.com. It also happens on our gitea instance (version 1.23.5). But I don't manage that and don't know what it runs on.

Database

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/needs-feedbackFor bugs, we need more details. For features, the feature must be described in more detailtype/bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions