Error while rebasing PR with conflicts #1836

Closed
opened 2025-11-02 04:14:42 -06:00 by GiteaMirror · 7 comments
Owner

Originally created by @apricote on GitHub (May 29, 2018).

[Macaron] 2018-05-29 22:29:47: Started POST /apricote/rebase-conflict/pulls/1/merge for [::1]
[git-module] /home/julian/.gitea/repositories/apricote/rebase-conflict.git: git -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= tag -l --sort=-v:refname
[git-module] /home/julian/.gitea/repositories/apricote/rebase-conflict.git: git -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= for-each-ref --format=%(refname) refs/heads/
[git-module] stdout:
refs/heads/feature
refs/heads/master

[git-module] /home/julian/.gitea/repositories/apricote/rebase-conflict.git: git -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= show-ref --verify refs/heads/master
[git-module] stdout:
4db6af38e879d59d87863ddeadc00d516cf9d4e3 refs/heads/master

[Macaron] 2018-05-29 22:29:47: Completed POST /apricote/rebase-conflict/pulls/1/merge 404 Not Found in 695.886888ms

Description

I am trying to merge a pull request with the "Rebase and Merge" style. The pull request UI shows me that "[t]his pull request can be merged automatically". When I now click the button, an error page 500 is shown with the message "An error has occurred : git rebase [/home/julian/.gitea/repositories/apricote/rebase-conflict.git -> /home/julian/go/src/code.gitea.io/gitea/data/tmp/local-repo/merge-249575514.git]: error: Failed to merge in the changes." and the PR did not get merged.

I think this bug is happening because the PullRequestStatusMergeable is set when the sum of all commits is auto-mergeable, this makes sense and works for the normal merge and also squashing. But because rebasing will merge in every commit on its own, any conflict that arises will immediately stop the (automatic) rebase.

You can check out the example repository at try.gitea.io/apricote/rebase-conflict, if you fork it to your own account and try to rebase the feature onto the master branch the error should surface.

This error also happens if using the proposed "rebase and merge (--no-ff)" feature in #4052.

Screenshots

rebase_1
rebase_2

Originally created by @apricote on GitHub (May 29, 2018). - Gitea version (or commit ref): master, 832ca50 - Git version: Locally tested with `2.17.0` - Operating system: Arch Linux Kernel `4.16.11` - Database (use `[x]`): Locally tested with SQLite - [ ] PostgreSQL - [ ] MySQL - [ ] MSSQL - [x] SQLite - Can you reproduce the bug at https://try.gitea.io: - [x] Yes: https://try.gitea.io/apricote/rebase-conflict/pulls/1 - [ ] No - [ ] Not relevant - Log gist: ``` [Macaron] 2018-05-29 22:29:47: Started POST /apricote/rebase-conflict/pulls/1/merge for [::1] [git-module] /home/julian/.gitea/repositories/apricote/rebase-conflict.git: git -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= tag -l --sort=-v:refname [git-module] /home/julian/.gitea/repositories/apricote/rebase-conflict.git: git -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= for-each-ref --format=%(refname) refs/heads/ [git-module] stdout: refs/heads/feature refs/heads/master [git-module] /home/julian/.gitea/repositories/apricote/rebase-conflict.git: git -c filter.lfs.required= -c filter.lfs.smudge= -c filter.lfs.clean= show-ref --verify refs/heads/master [git-module] stdout: 4db6af38e879d59d87863ddeadc00d516cf9d4e3 refs/heads/master [Macaron] 2018-05-29 22:29:47: Completed POST /apricote/rebase-conflict/pulls/1/merge 404 Not Found in 695.886888ms ``` ## Description I am trying to merge a pull request with the "Rebase and Merge" style. The pull request UI shows me that "[t]his pull request can be merged automatically". When I now click the button, an error page 500 is shown with the message "`An error has occurred : git rebase [/home/julian/.gitea/repositories/apricote/rebase-conflict.git -> /home/julian/go/src/code.gitea.io/gitea/data/tmp/local-repo/merge-249575514.git]: error: Failed to merge in the changes.`" and the PR did not get merged. I think this bug is happening because the `PullRequestStatusMergeable` is set when the sum of all commits is auto-mergeable, this makes sense and works for the normal merge and also squashing. But because rebasing will merge in every commit on its own, any conflict that arises will immediately stop the (automatic) rebase. You can check out the example repository at [try.gitea.io/apricote/rebase-conflict](https://try.gitea.io/apricote/rebase-conflict/graph), if you fork it to your own account and try to rebase the `feature` onto the `master` branch the error should surface. This error also happens if using the proposed "rebase and merge (--no-ff)" feature in #4052. ## Screenshots ![rebase_1](https://user-images.githubusercontent.com/3393079/40684636-26064298-6392-11e8-90b1-275083f40960.png) ![rebase_2](https://user-images.githubusercontent.com/3393079/40684646-299c73f0-6392-11e8-9154-13fe44c43fa3.png)
GiteaMirror added the issue/staletype/bug labels 2025-11-02 04:14:42 -06:00
Author
Owner

@sbstp commented on GitHub (Jun 5, 2018):

GitHub's docs discuss the issue. They just detect the conflicts and ask the user to rebase manually on the base branch and force push.
The animated GIF on this blog post seems to display a case like the one described here, the merge with commit button is green but the rebase and merge is grayed out.

@sbstp commented on GitHub (Jun 5, 2018): GitHub's docs discuss the [issue](https://help.github.com/articles/about-pull-request-merges/#rebase-and-merge-your-pull-request-commits). They just detect the conflicts and ask the user to rebase manually on the base branch and force push. The animated GIF on [this](https://blog.github.com/2016-09-26-rebase-and-merge-pull-requests/) blog post seems to display a case like the one described here, the merge with commit button is green but the rebase and merge is grayed out.
Author
Owner

@yegordovganich commented on GitHub (Mar 4, 2019):

Can it be fixed sooner than 1.9.0 Milestone, please. It's quite inconvenient...

@yegordovganich commented on GitHub (Mar 4, 2019): Can it be fixed sooner than 1.9.0 Milestone, please. It's quite inconvenient...
Author
Owner

@apricote commented on GitHub (Mar 4, 2019):

AFAIK no one is working on this issue. The assigned milestone does not reflect the actual planned release for the fix/bug.

@apricote commented on GitHub (Mar 4, 2019): AFAIK no one is working on this issue. The assigned milestone does not reflect the actual planned release for the fix/bug.
Author
Owner

@yegordovganich commented on GitHub (Mar 4, 2019):

OK, so what is the actual planned release?:)

@yegordovganich commented on GitHub (Mar 4, 2019): OK, so what is the actual planned release?:)
Author
Owner

@lunny commented on GitHub (Mar 17, 2019):

I think we should fix that on v1.9 or before.

@lunny commented on GitHub (Mar 17, 2019): I think we should fix that on v1.9 or before.
Author
Owner

@stale[bot] commented on GitHub (May 16, 2019):

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.

@stale[bot] commented on GitHub (May 16, 2019): This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions.
Author
Owner

@stale[bot] commented on GitHub (May 30, 2019):

This issue has been automatically closed because of inactivity. You can re-open it if needed.

@stale[bot] commented on GitHub (May 30, 2019): This issue has been automatically closed because of inactivity. You can re-open it if needed.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#1836