Description
Description
Creating a PR against a branch with changes to a file that has since been renamed in the target branch will cause an error 500 and inability to open the PR. When this happens, the server logs only say
2022/12/09 14:35:19 ...ers/web/repo/pull.go:1244:CompareAndPullRequestPost() [E] NewPullRequest: git apply --check: exit status 1
so it's difficult to understand what to do to work around it. The appropriate workaround is to update the source branch with latest from the target branch before opening the PR.
Specific repro steps:
- Create a repo.
- Create a file. Make sure it's long enough that a rename + changing contents will still detect the rename.
- Create a branch from this commit.
- Change something in that file and branch.
- Back in the target branch, rename the file and make a small change in it as well.
- Attempt to open a PR from the outdated source branch to the target branch with the renamed + changed file.
- The diff on this page looks fine, but trying to actually create the PR results in a 500 error on client and "git apply --check" error on server.
I can supply specific git commands needed for each step if it's helpful, but hopefully they're obvious from the given links.
Locally running the git apply
command that the server is presumably running results in the following message (that doesn't show up on the server):
> git show 0bb985908ca24a8fd06972ee8a38a28297957ed8 | git apply --check
error: 1.txt: No such file or directory
which is what clued me into the problem.
Gitea Version
1.17.3, can also repro on try.gitea.io at v1.19.0+dev-171-g2779d47ad
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
See description
Screenshots
Git Version
2.37.3 on the Gitea v1.17.3 instance, whatever version is on try.gitea.io
Operating System
Ubuntu 20.04.5 aarch64
How are you running Gitea?
Built myself with a few modifications from v1.17.3 (mostly cherry-picking things from the future).
https://try.gitea.io however that's built
Database
PostgreSQL