summaryrefslogtreecommitdiffstats
path: root/routers/api
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2024-03-20 09:38:30 +0800
committerGitHub <noreply@github.com>2024-03-20 09:38:30 +0800
commit408c92938ba6f38eea1210cae2c485e1f19d4982 (patch)
tree7ba0e7b7e0375ea0fa3997e1e1b1018e57d236bc /routers/api
parentb9dd5dd471858c52cd7b202995ab64f6fe28a519 (diff)
downloadgitea-408c92938ba6f38eea1210cae2c485e1f19d4982.tar.gz
gitea-408c92938ba6f38eea1210cae2c485e1f19d4982.zip
Fix PR creation via api between branches of same repo with head field 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>
Diffstat (limited to 'routers/api')
-rw-r--r--routers/api/v1/repo/pull.go2
1 files changed, 2 insertions, 0 deletions
diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go
index 5b9ec4e132..f55ede3f73 100644
--- a/routers/api/v1/repo/pull.go
+++ b/routers/api/v1/repo/pull.go
@@ -969,6 +969,8 @@ func parseCompareInfo(ctx *context.APIContext, form api.CreatePullRequestOption)
return nil, nil, nil, nil, "", ""
}
headBranch = headInfos[1]
+ // The head repository can also point to the same repo
+ isSameRepo = ctx.Repo.Owner.ID == headUser.ID
} else {
ctx.NotFound()