From 33468630e6a60325f39539d8179f14555c482316 Mon Sep 17 00:00:00 2001 From: Norwin Date: Sun, 25 Oct 2020 10:40:27 +0800 Subject: [PATCH] fix `tea pr create` within same repo (#248) Merge branch 'master' into fix-pulls-create-same-repo fix pr head detection for PR within same repo regression introduced by #202 Co-authored-by: Lunny Xiao Co-authored-by: Norwin Roosen Reviewed-on: https://gitea.com/gitea/tea/pulls/248 Reviewed-by: 6543 <6543@noreply.gitea.io> Reviewed-by: Lunny Xiao Co-Authored-By: Norwin Co-Committed-By: Norwin --- cmd/pulls/create.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/cmd/pulls/create.go b/cmd/pulls/create.go index dbeb267..7f91c0a 100644 --- a/cmd/pulls/create.go +++ b/cmd/pulls/create.go @@ -108,7 +108,11 @@ func runPullsCreate(ctx *cli.Context) error { log.Fatal(err) } owner, _ := utils.GetOwnerAndRepo(strings.TrimLeft(url.Path, "/"), "") - head = fmt.Sprintf("%s:%s", owner, branchName) + if owner != repo.Owner.UserName { + head = fmt.Sprintf("%s:%s", owner, branchName) + } else { + head = branchName + } } title := ctx.String("title")