-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
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
Gitea incorrectly auto-closes issue even though referenced branch has not been merged yet #33929
Comments
That branch selector does nothing more than just record/display a name. It affects nothing. That's why I suggested to remove it, see the original proposal in "Fix bug of branch/tag selector in the issue sidebar #32744 " |
It obviously causes a bug in the auto-closing issue feature. Because the issue is not auto-closed if I don't link the issue to the pull request branch.
While the mentioned PR may have been merged it does not seem to be included in any of the upcoming releases (1.23.6 or 1.24)? There's also #20226 (included in the 1.24.0 milestone). Won't that require again a link between issue and pull request branch? |
Because that PR didn't really remove the selector. See its discussion, a user said that they still need that selector.
That's a new proposal |
Then I don't understand the relevance for this issue? If the branch selector is not going to be removed then the bug I am describing here remains, and should be fixed. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Hmm, I think I could overall understand the problem now. It seems to be a feature from "Fix permission checks for close/reopen from commit (#8875)" The logic is like this: if an issue Actually you could also reproduce it by this step:
I guess it can't be considered as a bug since it was designed to work that way, some users used to follow this workflow. By the way, there is even an option in repo's setting page: "Close an issue via a commit made in a non default branch", it could close an issue by a commit in any branch (but not only the "referred" one) by So maybe the solution is: do not use that branch selector if you don't need it ......... Related logic: gitea/services/repository/push.go Line 249 in 39fc2e7
gitea/services/issue/commit.go Line 199 in 39fc2e7
|
The point is that I did not enable that setting. And therefore expected that having At the very least, the wording of that option is not clear, and gitea's behavior is inconsistent. Because if I just do a normal push of a |
I did not say you enabled that setting. I was just explaining the whole design. I think I have said clearly that By the way (but not only ...).
Please read the explanation above again: a commit in branch
That's not true. A normal push also also behaves exactly the same: a commit in branch |
And actually I do not know why you need that branch selector to choose a branch for an issue. So quote the comment above:
If you really need it, could you help to elaborate your workflow? |
I don't really need it. And yes, now that I know that the branch selection feature is causing the bug I can work around it and not use the branch selector. But I don't understand what point you are trying to make here? Are you saying this is not a bug? Then I would strongly disagree. As long as this branch selection feature exists some people will use it. And they will encounter this bug that I am describing. And they will become confused and frustrated with gitea. |
Then it comes to that background:
😆 In my mind that "branch selector" is an out-dated feature, it was designed that way so it's hard to say it is really a bug or not. But I failed to remove it because some users said they still need it ..... As an open-source and crowd-contributed project, many features were written in old days and the original author maintainers are not active anymore. I am just trying to clarify everything at the moment. To be honest, I don't quite understand how to correctly maintain this feature to satisfy every user. |
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
Create a repo with a single file
README.md
.Create issue "A" in that repo
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 itCreate a pull request based on branch "<issue_number>-A" above
Link the issue to the pull request branch "<issue_number>-A"
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 itCreate a pull request for the second branch "B", and merge it using "Rebase
then fast-forward" and selecting "Delete Branch "B""
Pull the updated "main" branch locally, switch to branch "<issue_number>-A", and run
git rebase main
Resolve the conflict in
README.md
keeping both changes, and rungit add README.md
, thengit rebase --continue
Run
git push --force-with-lease
Result
Issue "A" is auto-closed (see https://demo.gitea.com/reimer-atb/test/issues/1)
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).
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
The text was updated successfully, but these errors were encountered: