Description
Description
Steps to reproduce:
Create a repository
create a commit
create a new branch
make a change to the file from the original commit in the new branch
create a pull request
merge the pull request
click the merge commit id e.g. https://try.gitea.io/JensTimmerman/test/commit/84f4738d2ab5263abe4dc2460b24c4d78aa6c68c
click on operations, revert
select the main branch in the pop up
select create a new branch for this commit and start a pull request
on the revert page that shows up (e.g. https://try.gitea.io/JensTimmerman/test/_cherrypick/84f4738d2ab5263abe4dc2460b24c4d78aa6c68c/main?ref=main&refType=branch&cherry-pick-type=revert )
click propose file change
You get an error (on the page https://try.gitea.io/JensTimmerman/test/_cherrypick/84f4738d2ab5263abe4dc2460b24c4d78aa6c68c/main ):
Unable to apply patch 'Error: Stdout: Stderr: error: No valid patches in input (allow with "--allow-empty") Err: exit status 128'
(this error is slighty different on different versions of gitea, or perhaps depending on the exact test scenario)
The 'new patch' textfield shows
revert 84f4738d2ab5263abe4dc2460b24c4d78aa6c68c
instead of the code to be changed
The debug logs state:
2022/12/24 22:36:02 ...dules/git/command.go:179:Run() [D] [63a77ed2] /var/lib/gitea/data/tmp/local-repo/upload.git1909367275: /usr/bin/git -c protocol.version=2 -c uploadpack.allowfilter=true -c uploadpack.allowAnySHA1InWant=true -c credential.helper= read-tree -m a0830bee2fbb72fb55370bc8a9c0c4e05acba853 686d56c5e84498ca372c8ed86b9e743aa57c4955 b269bbeb490033dd65b029dce65b85780cd2a519
2022/12/24 22:36:02 ...rvices/pull/patch.go:238:AttemptThreeWayMerge() [E] [63a77ed2] Unable to run read-tree -m! Error: exit status 128 - fatal: this operation must be run in a work tree
- fatal: this operation must be run in a work tree
Gitea Version
1.17.4
Can you reproduce the bug on the Gitea demo site?
Yes
Log Gist
No response
Screenshots
Git Version
2.31.1
Operating System
centos8 stream
How are you running Gitea?
I'm using the do1jlr.gitea ansible role to deploy on a container on centos8stream running on proxmox.
But this is probably not relevant since I'm able to reproduce this issue on try.gitea.io.
Database
PostgreSQL