File tree 2 files changed +35
-7
lines changed
2 files changed +35
-7
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,12 @@ package commands
3
3
import (
4
4
"fmt"
5
5
"os"
6
+ "os/exec"
6
7
"path"
7
8
9
+ "github.com/barelyhuman/commitlog/lib"
8
10
"github.com/barelyhuman/commitlog/pkg"
9
11
"github.com/go-git/go-git/v5"
10
- "github.com/go-git/go-git/v5/config"
11
12
"github.com/go-git/go-git/v5/plumbing"
12
13
"github.com/urfave/cli/v2"
13
14
)
@@ -114,16 +115,25 @@ func Release(c *cli.Context) (err error) {
114
115
}
115
116
116
117
if c .Bool ("push" ) {
117
- _ , err : = repoWt .Status ()
118
+ _ , err = repoWt .Status ()
118
119
if err != nil {
119
120
return err
120
121
}
121
122
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
+ }
127
137
}
128
138
129
139
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