summaryrefslogtreecommitdiffstats
path: root/modules/git/command.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/git/command.go')
-rw-r--r--modules/git/command.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/modules/git/command.go b/modules/git/command.go
index b24d32dbe8..8ebd8898fb 100644
--- a/modules/git/command.go
+++ b/modules/git/command.go
@@ -95,6 +95,18 @@ func (c *Command) AddArguments(args ...string) *Command {
return c
}
+// AddDynamicArguments adds new dynamic argument(s) to the command.
+// If the argument is invalid (it shouldn't happen in real life), it panics to caller
+func (c *Command) AddDynamicArguments(args ...string) *Command {
+ for _, arg := range args {
+ if arg != "" && arg[0] == '-' {
+ panic("invalid argument: " + arg)
+ }
+ }
+ c.args = append(c.args, args...)
+ return c
+}
+
// RunOpts represents parameters to run the command. If UseContextTimeout is specified, then Timeout is ignored.
type RunOpts struct {
Env []string