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 <xiaolunwen@gmail.com>
Co-authored-by: Norwin Roosen <git@nroo.de>
Reviewed-on: https://gitea.com/gitea/tea/pulls/248
Reviewed-by: 6543 <6543@noreply.gitea.io>
Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-Authored-By: Norwin <noerw@noreply.gitea.io>
Co-Committed-By: Norwin <noerw@noreply.gitea.io>
This commit is contained in:
Norwin 2020-10-25 10:40:27 +08:00 committed by Lunny Xiao
parent 48c1c50796
commit 33468630e6
1 changed files with 5 additions and 1 deletions

View File

@ -108,7 +108,11 @@ func runPullsCreate(ctx *cli.Context) error {
log.Fatal(err) log.Fatal(err)
} }
owner, _ := utils.GetOwnerAndRepo(strings.TrimLeft(url.Path, "/"), "") 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") title := ctx.String("title")