aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/code.gitea.io/git/command.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2016-12-22 17:30:52 +0800
committerThomas Boerger <thomas@webhippie.de>2016-12-22 10:30:52 +0100
commit47a7529d9655e11471bbe39958222a13854a6133 (patch)
tree98e597255245e17d39a0062c3977fb8a510cf413 /vendor/code.gitea.io/git/command.go
parent0c5c34d7ddaf31a6d8123dac36b221de61f5ff96 (diff)
downloadgitea-47a7529d9655e11471bbe39958222a13854a6133.tar.gz
gitea-47a7529d9655e11471bbe39958222a13854a6133.zip
update code.gitea.io/git (#450)
Diffstat (limited to 'vendor/code.gitea.io/git/command.go')
-rw-r--r--vendor/code.gitea.io/git/command.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/vendor/code.gitea.io/git/command.go b/vendor/code.gitea.io/git/command.go
index f7fce67bee..43e6eea900 100644
--- a/vendor/code.gitea.io/git/command.go
+++ b/vendor/code.gitea.io/git/command.go
@@ -13,6 +13,11 @@ import (
"time"
)
+var (
+ // GlobalCommandArgs global command args for external package setting
+ GlobalCommandArgs []string
+)
+
// Command represents a command with its subcommands or arguments.
type Command struct {
name string
@@ -30,7 +35,7 @@ func (c *Command) String() string {
func NewCommand(args ...string) *Command {
return &Command{
name: "git",
- args: args,
+ args: append(GlobalCommandArgs, args...),
}
}
@@ -40,13 +45,11 @@ func (c *Command) AddArguments(args ...string) *Command {
return c
}
-const DEFAULT_TIMEOUT = 60 * time.Second
-
// RunInDirTimeoutPipeline executes the command in given directory with given timeout,
// it pipes stdout and stderr to given io.Writer.
func (c *Command) RunInDirTimeoutPipeline(timeout time.Duration, dir string, stdout, stderr io.Writer) error {
if timeout == -1 {
- timeout = DEFAULT_TIMEOUT
+ timeout = 60 * time.Second
}
if len(dir) == 0 {
@@ -106,7 +109,7 @@ func (c *Command) RunInDirPipeline(dir string, stdout, stderr io.Writer) error {
return c.RunInDirTimeoutPipeline(-1, dir, stdout, stderr)
}
-// RunInDir executes the command in given directory
+// RunInDirBytes executes the command in given directory
// and returns stdout in []byte and error (combined with stderr).
func (c *Command) RunInDirBytes(dir string) ([]byte, error) {
return c.RunInDirTimeout(-1, dir)