| 40 | } |
| 41 | |
| 42 | func (g *gitExecuter) CreateBranch(branch, ref, upstream string) error { |
| 43 | ctx := context.Background() |
| 44 | cmd, err := g.client.Command(ctx, "branch", branch, ref) |
| 45 | if err != nil { |
| 46 | return err |
| 47 | } |
| 48 | if _, err := cmd.Output(); err != nil { |
| 49 | return err |
| 50 | } |
| 51 | cmd, err = g.client.Command(ctx, "branch", "--set-upstream-to", upstream, branch) |
| 52 | if err != nil { |
| 53 | return err |
| 54 | } |
| 55 | _, err = cmd.Output() |
| 56 | return err |
| 57 | } |
| 58 | |
| 59 | func (g *gitExecuter) CurrentBranch() (string, error) { |
| 60 | return g.client.CurrentBranch(context.Background()) |