mirror of
https://gitea.com/gitea/tea.git
synced 2024-12-22 09:05:06 +01:00
Fix Pulls Create (#202)
small refactor fix TrimLeft bug, improve logging Co-authored-by: Norwin Roosen <git@nroo.de> Reviewed-on: https://gitea.com/gitea/tea/pulls/202 Reviewed-by: 6543 <6543@noreply.gitea.io> Reviewed-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
159bf03d49
commit
887495f38f
@ -339,7 +339,7 @@ func runPullsCreate(ctx *cli.Context) error {
|
||||
login, ownerArg, repoArg := initCommand()
|
||||
client := login.Client()
|
||||
|
||||
repo, _, err := login.Client().GetRepo(ownerArg, repoArg)
|
||||
repo, _, err := client.GetRepo(ownerArg, repoArg)
|
||||
if err != nil {
|
||||
log.Fatal("could not fetch repo meta: ", err)
|
||||
}
|
||||
@ -374,7 +374,7 @@ func runPullsCreate(ctx *cli.Context) error {
|
||||
|
||||
remote, err := localRepo.TeaFindBranchRemote("", sha)
|
||||
if err != nil {
|
||||
return err
|
||||
log.Fatal("could not determine remote for current branch: ", err)
|
||||
}
|
||||
|
||||
if remote == nil {
|
||||
@ -422,7 +422,7 @@ func runPullsCreate(ctx *cli.Context) error {
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
log.Fatal("could not create PR: ", err)
|
||||
log.Fatalf("could not create PR from %s to %s:%s: %s", head, ownerArg, base, err)
|
||||
}
|
||||
|
||||
in := fmt.Sprintf("# #%d %s (%s)\n%s created %s\n\n%s\n", pr.Index,
|
||||
@ -436,7 +436,7 @@ func runPullsCreate(ctx *cli.Context) error {
|
||||
fmt.Print(out)
|
||||
|
||||
fmt.Println(pr.HTMLURL)
|
||||
return nil
|
||||
return err
|
||||
}
|
||||
|
||||
func argToIndex(arg string) (int64, error) {
|
||||
|
@ -229,5 +229,5 @@ func (r TeaRepo) TeaGetCurrentBranchName() (string, error) {
|
||||
return "", fmt.Errorf("active ref is no branch")
|
||||
}
|
||||
|
||||
return strings.TrimLeft(localHead.Name().String(), "refs/heads/"), nil
|
||||
return strings.TrimPrefix(localHead.Name().String(), "refs/heads/"), nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user