File tree Expand file tree Collapse file tree 2 files changed +35
-7
lines changed Expand file tree Collapse file tree 2 files changed +35
-7
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,12 @@ package commands
33import (
44 "fmt"
55 "os"
6+ "os/exec"
67 "path"
78
9+ "github.com/barelyhuman/commitlog/lib"
810 "github.com/barelyhuman/commitlog/pkg"
911 "github.com/go-git/go-git/v5"
10- "github.com/go-git/go-git/v5/config"
1112 "github.com/go-git/go-git/v5/plumbing"
1213 "github.com/urfave/cli/v2"
1314)
@@ -114,16 +115,25 @@ func Release(c *cli.Context) (err error) {
114115 }
115116
116117 if c .Bool ("push" ) {
117- _ , err : = repoWt .Status ()
118+ _ , err = repoWt .Status ()
118119 if err != nil {
119120 return err
120121 }
121122
122- gitRepo .Push (& git.PushOptions {
123- RemoteName : "origin" ,
124- Progress : os .Stdout ,
125- RefSpecs : []config.RefSpec {config .RefSpec ("refs/tags/*:refs/tags/*" )},
126- })
123+ cmd := exec .Command ("git" , "push" )
124+ cmd .Dir = fileDir
125+ err = lib .Command (cmd )
126+
127+ if err != nil {
128+ return err
129+ }
130+
131+ cmd = exec .Command ("git" , "push" , "--tags" )
132+ cmd .Dir = fileDir
133+
134+ if err = lib .Command (cmd ); err != nil {
135+ return err
136+ }
127137 }
128138
129139 return err
Original file line number Diff line number Diff line change 1+ package lib
2+
3+ import (
4+ "log"
5+ "os/exec"
6+ "strings"
7+ )
8+
9+ func Command (cmd * exec.Cmd ) error {
10+ var w strings.Builder
11+ cmd .Stderr = & w
12+ err := cmd .Run ()
13+ if err != nil {
14+ log .Println (strings .TrimSpace (w .String ()))
15+ return err
16+ }
17+ return nil
18+ }
You can’t perform that action at this time.
0 commit comments