-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Improve the test for mergeability #6417
Comments
Please note that this is a constructed example to show the limitations of the current check. Having the same contents also results in Gitea showing 404 on the files tab: While Github still shows the changes: I haven't investigated what Github could do different for the file diffs. Edit: Don't mind the 404, I linked the wrong repository 😆 |
Did you mean to post https://try.gitea.io/conflicttest/noconflict/pulls/1? Your other links 404 |
You're right, I messed up the repository names :-) |
…-file functionality (#18004) The current TestPatch conflict code uses a plain git apply which does not properly account for 3-way merging. However, we can improve things using `git read-tree -m` to do a three-way merge then follow the algorithm used in merge-one-file. We can also use `--patience` and/or `--histogram` to generate a nicer diff for applying patches too. Fix #13679 Fix #6417 Signed-off-by: Andrew Thornton <art27@cantab.net>
…-file functionality (go-gitea#18004) The current TestPatch conflict code uses a plain git apply which does not properly account for 3-way merging. However, we can improve things using `git read-tree -m` to do a three-way merge then follow the algorithm used in merge-one-file. We can also use `--patience` and/or `--histogram` to generate a nicer diff for applying patches too. Fix go-gitea#13679 Fix go-gitea#6417 Signed-off-by: Andrew Thornton <art27@cantab.net>
cd8cdbd
https://try.gitea.io/conflicttest/noconflict/pulls/1
Description
In our workflow we have two branches with continuous deployment:
master
andqa
(production and quality assurance).Because both deploy on new pushes, they're both branch protected and require a PR with a review.
We always branch off new features from
master
and the first target after development isqa
for acceptance testing.We often seem to have conflicts when targeting a feature to
qa
, because theqa
has more features that are currently in testing and are not released intomaster
yet.What we do then is manually resolve the issues so that git is able to merge it locally.
Merging
qa
into the feature is no option, because then the feature is dependent on other features that might not be ready for production.Now to the Gitea part :-)
Have a look at this PR which emulates a conflict that is shown in Gitea but can be merged locally.
Gitea isn't able to merge it and just says it is conflicted.
However, you can do the following:
Git is happy to merge it.
I've also tested what Github would show, here is the result: MarkusAmshove/Conflict#1
The problem seems to be that Gitea "just" tries to apply the branch as a patch with, which can be reproduced locally:
So, what could Gitea do better in that regard?
I think that instead of doing the patch approach, Gitea should try the different merge strategies it supports (which can be configured at the repositoy settings page) and see if the PR is actually mergeable.
We only have
--no-ff
enabled as a possibility and the exit code would be an indicator:In another repository where there are indeed conflicts:
Proposal
When testing for mergeability of a PR, try the different merge strategies configured in Gitea (for the repository) to see if the PR can be merged.
Bonus points if, when there are multiple strategies configured, Gitea "grays out" strategies that aren't possible.
The text was updated successfully, but these errors were encountered: