diff options
author | zeripath <art27@cantab.net> | 2019-08-05 21:39:39 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-08-05 21:39:39 +0100 |
commit | 7ad67109d732bd560c8da0356aa555be467d786c (patch) | |
tree | 7c7a35761b01e2eec6a823f0caf40748c3b7f327 /modules/git/repo.go | |
parent | 1d8915ad5d9889c02dd98ab2c2f29aa8f5ee4dfa (diff) | |
download | gitea-7ad67109d732bd560c8da0356aa555be467d786c.tar.gz gitea-7ad67109d732bd560c8da0356aa555be467d786c.zip |
Be more strict with git arguments (#7715)
* Be more strict with git arguments
* fix-up commit test
* use bindings for branch name
Diffstat (limited to 'modules/git/repo.go')
-rw-r--r-- | modules/git/repo.go | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/modules/git/repo.go b/modules/git/repo.go index 8a40fb1b91..28e54a1bbc 100644 --- a/modules/git/repo.go +++ b/modules/git/repo.go @@ -187,8 +187,7 @@ func Pull(repoPath string, opts PullRemoteOptions) error { if opts.All { cmd.AddArguments("--all") } else { - cmd.AddArguments(opts.Remote) - cmd.AddArguments(opts.Branch) + cmd.AddArguments("--", opts.Remote, opts.Branch) } if opts.Timeout <= 0 { @@ -213,7 +212,7 @@ func Push(repoPath string, opts PushOptions) error { if opts.Force { cmd.AddArguments("-f") } - cmd.AddArguments(opts.Remote, opts.Branch) + cmd.AddArguments("--", opts.Remote, opts.Branch) _, err := cmd.RunInDirWithEnv(repoPath, opts.Env) return err } |