Closed
Description
Observed
When POSTing to /repos/{owner}/{repo}/pulls
to create a pull request
with a payload which specifies head
to be the same repository as in
the 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
and myuser: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:
# jexec gitea freebsd-version
13.1-RELEASE
# jexec gitea uname -a
FreeBSD gitea 13.1-RELEASE FreeBSD 13.1-RELEASE releng/13.1-n250148-fc952ac2212 TRITON131 amd64
#
#
# pkg -j gitea info gitea
gitea-1.16.7
Name : gitea
Version : 1.16.7
Installed on : Sat Jun 18 15:48:24 2022 CEST
Origin : www/gitea
Architecture : FreeBSD:13:amd64
Prefix : /usr/local
Categories : www
Licenses : MIT
Maintainer : stb@lassitu.de
WWW : https://gitea.io/en-US/
Comment : Compact self-hosted Git service
Options :
BINDATA : off
GIT_LFS : on
PAM : on
SQLITE : on
Annotations :
FreeBSD_version: 1300139
cpe : cpe:2.3:a:gitea:gitea:1.16.7:::::freebsd13:x64
repo_type : binary
repository : FreeBSD
Flat size : 104MiB
Description :
A self-hosted Git service.
Gitea is a community managed fork of Gogs, lightweight code hosting solution
written in Go and published under the MIT license.
WWW: https://gitea.io/en-US/
#