@@ -68,7 +68,7 @@ func (g *Git) LsRemote(branch string, commit string) (string, error) {
68
68
}
69
69
70
70
output := & bytes.Buffer {}
71
- if err := g .gitCmd (output , "ls-remote" , g .URL , formatRefForBranch (branch )); err != nil {
71
+ if err := g .gitCmd (output , "ls-remote" , "--" , g .URL , formatRefForBranch (branch )); err != nil {
72
72
return "" , err
73
73
}
74
74
@@ -97,9 +97,9 @@ func (g *Git) Head(branch string) (string, error) {
97
97
// Clone runs git clone with depth 1
98
98
func (g * Git ) Clone (branch string ) error {
99
99
if branch == "" {
100
- return g .git ("clone" , "--depth=1" , "-n" , g .URL , g .Directory )
100
+ return g .git ("clone" , "--depth=1" , "-n" , "--" , g .URL , g .Directory )
101
101
}
102
- return g .git ("clone" , "--depth=1" , "-n" , "--branch" , branch , g .URL , g .Directory )
102
+ return g .git ("clone" , "--depth=1" , "-n" , "--branch=" + branch , "--" , g .URL , g .Directory )
103
103
}
104
104
105
105
// Update updates git repo if remote sha has changed
@@ -302,22 +302,22 @@ func (g *Git) clone(branch string) error {
302
302
}
303
303
304
304
func (g * Git ) fetchAndReset (rev string ) error {
305
- if err := g .git ("-C" , g .Directory , "fetch" , "origin" , rev ); err != nil {
305
+ if err := g .git ("-C" , g .Directory , "fetch" , "origin" , "--" , rev ); err != nil {
306
306
return err
307
307
}
308
308
return g .reset ("FETCH_HEAD" )
309
309
}
310
310
311
311
func (g * Git ) reset (rev string ) error {
312
- return g .git ("-C" , g .Directory , "reset" , "--hard" , rev )
312
+ return g .git ("-C" , g .Directory , "reset" , "--hard" , "--" , rev )
313
313
}
314
314
315
315
func (g * Git ) currentCommit () (string , error ) {
316
316
return g .gitOutput ("-C" , g .Directory , "rev-parse" , "HEAD" )
317
317
}
318
318
319
319
func (g * Git ) gitCmd (output io.Writer , args ... string ) error {
320
- kv := fmt .Sprintf ("credential.helper=%s" , " /bin/sh -c 'echo password=$GIT_PASSWORD'" )
320
+ kv := fmt .Sprintf ("credential.helper=%s" , ` /bin/sh -c 'echo " password=$GIT_PASSWORD"'` )
321
321
cmd := exec .Command ("git" , append ([]string {"-c" , kv }, args ... )... )
322
322
cmd .Env = append (os .Environ (), fmt .Sprintf ("GIT_PASSWORD=%s" , g .password ))
323
323
stderrBuf := & bytes.Buffer {}
0 commit comments