-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
False Merge Conflict On Pull Request - A blocking issue for using Gitea #9227
Comments
This issue is likely related to #8630 but for clarity this trivial example is not complicated by changes to the PR's target branch (if that makes sense). |
Further observation: If you close PR B and reopen it then you are able to proceed with the merging the pull request (PR B). Speculation: It seems like the internal PR merge patch is not being updated to reflect changes from the previously merged pull request (PR A). |
Any error logs could you find on your system about merging. |
@lunny I'm not seeing any errors in the logs that jump out at me - is there anything specific I should be looking for!? Edit: The example on gitea.io is currently in the errored state - i.e. showing a merge conflict when there is none. |
Related: #6417 |
So the issue is that when we determine conflict we don't actually try to merge - we create a patch and try to apply that. The code testing the patch is: Lines 498 to 595 in 95a5739
With the patch being created here: Line 506 in 95a5739
Which looks a bit like an odd construction, and maps to: Line 895 in 95a5739
With the file appearing to be generated in functions below this using There's multiple issues with this, not least the fact that patches can be arbitrarily large and this function implies we're storing these in memory at some point!! It looks like savepatch is called in two places: Line 640 in 82e0383
Line 808 in 82e0383
And I would guess that either they're generated plainly from head to merge base or they're not run necessarily at the right time. This code needs completely redoing. We absolutely cannot store arbitrary patches in memory - diff and blame are other places where this happens. It appears that the only reason for this to go in to memory is to check its length (!) I'm not certain of the utility of creating a patch file to be stored on the server in any case - we don't use it for anything else afaics - and as shown above it is probably better to just generate on the fly at testing when we know what we're patching against. (This reading of patch files in to memory is likely the cause of several other issues complaining about high memory use.) |
I should note that the above was fixed by #9302 |
Would anyone be able to test on master to see if #9302 has solved the issue? |
I can't replicate this since #9302 was merged. Therefore I'm closing this issue. |
First off thank you for this OS project - amazing work!!
Description
Gitea shows a false merge/PR conflict when there is none.
This issue is also present in many other scenarios that involve pushing changes to a branch being merged into which do not cause a merge conflict. I have simplified this issue by using the most trivial example to clearly illustrate the issue.
This issue is also on my locally hosted servers of which I have both v1.10.0 and the latest dev build in Docker - they all (including on try.gitea.io) exhibit the same issue.
NOTE: This is a blocking issue for using Gitea even in a trivial scenario.
Steps to reproduce:
On my local instance of Gitea (v1.10.0) which has the same issue, I was able to do a
git diff
ofmaster
withB
(on the bare repo) and it correctly showed only the changes that were made on branchB
(since PR A was now merged intmaster
) which is not a conflict ifB
was merged intomaster
(i.e. for PR B).To prove that last statement, do the following additional steps:
Screenshots
What you see in PR #2 (PR B) in the example.
The text was updated successfully, but these errors were encountered: