-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
POSTing to /repos/{owner}/{repo}/pulls
with explicit head incorrectly returns 404 if base and head are the same repository
#20175
Comments
This is currently broken as there is a bug in gitea itself preventing us to submit PRs easily: go-gitea/gitea#20175
I've encountered the same problem using GitHub actions create-pull-request module in conjunction with Gitea actions. This module in order to create pull request uses mentioned in title endpoint and specifies in |
… namespaced (#26986) Fix #20175 Current implementation of API does not allow creating pull requests between branches of the same repo when you specify *namespace* (owner of the repo) in `head` field in http request body. --- Although GitHub implementation of API allows performing such action and since Gitea targeting compatibility with GitHub API I see it as an appropriate change. I'm proposing a fix to the described problem and test case which covers this logic. My use-case just in case: #20175 (comment)
… namespaced (go-gitea#26986) Fix go-gitea#20175 Current implementation of API does not allow creating pull requests between branches of the same repo when you specify *namespace* (owner of the repo) in `head` field in http request body. --- Although GitHub implementation of API allows performing such action and since Gitea targeting compatibility with GitHub API I see it as an appropriate change. I'm proposing a fix to the described problem and test case which covers this logic. My use-case just in case: go-gitea#20175 (comment)
… namespaced (go-gitea#26986) Fix go-gitea#20175 Current implementation of API does not allow creating pull requests between branches of the same repo when you specify *namespace* (owner of the repo) in `head` field in http request body. --- Although GitHub implementation of API allows performing such action and since Gitea targeting compatibility with GitHub API I see it as an appropriate change. I'm proposing a fix to the described problem and test case which covers this logic. My use-case just in case: go-gitea#20175 (comment)
… namespaced (#26986) (#29857) Backport #26986 by @norohind Fix #20175 Current implementation of API does not allow creating pull requests between branches of the same repo when you specify *namespace* (owner of the repo) in `head` field in http request body. --------- Co-authored-by: norohind <60548839+norohind@users.noreply.github.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
… namespaced (#26986) Fix #20175 Current implementation of API does not allow creating pull requests between branches of the same repo when you specify *namespace* (owner of the repo) in `head` field in http request body. --- Although GitHub implementation of API allows performing such action and since Gitea targeting compatibility with GitHub API I see it as an appropriate change. I'm proposing a fix to the described problem and test case which covers this logic. My use-case just in case: go-gitea/gitea#20175 (comment) (cherry picked from commit ed02d1fab85c9b8206c0af84dcfc3792e61609cf)
Observed
When POSTing to
/repos/{owner}/{repo}/pulls
to create a pull requestwith a payload which specifies
head
to be the same repository as inthe request such that the source and the target repository are the
same and not a fork, the REST API returns a 404 with an error message
GetForkedRepo
.e.g. in route
myuser/repo
andmyuser:some-branch
in payload.Expected
I expect this to create the pull request instead of just returning an
incorrect and confusing error message.
Details
The bug seems to be that the branch in
https://github.com/go-gitea/gitea/blob/main/routers/api/v1/repo/pull.go#L940-L951
does not check if it actually is the same repository and thus doesn't
set
isSameRepo
to true.Versions
I saw this behaviour when runnig gitea in a FreeBSD 13.1-RELEASE jail:
The text was updated successfully, but these errors were encountered: