aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/git/command.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/modules/git/command.go b/modules/git/command.go
index 649d9cf249..ac26ef8689 100644
--- a/modules/git/command.go
+++ b/modules/git/command.go
@@ -32,10 +32,11 @@ const DefaultLocale = "C"
// Command represents a command with its subcommands or arguments.
type Command struct {
- name string
- args []string
- parentContext context.Context
- desc string
+ name string
+ args []string
+ parentContext context.Context
+ desc string
+ globalArgsLength int
}
func (c *Command) String() string {
@@ -51,9 +52,10 @@ func NewCommand(ctx context.Context, args ...string) *Command {
cargs := make([]string, len(globalCommandArgs))
copy(cargs, globalCommandArgs)
return &Command{
- name: GitExecutable,
- args: append(cargs, args...),
- parentContext: ctx,
+ name: GitExecutable,
+ args: append(cargs, args...),
+ parentContext: ctx,
+ globalArgsLength: len(globalCommandArgs),
}
}
@@ -140,7 +142,7 @@ func (c *Command) RunWithContext(rc *RunContext) error {
desc := c.desc
if desc == "" {
- desc = fmt.Sprintf("%s %s [repo_path: %s]", c.name, strings.Join(c.args, " "), rc.Dir)
+ desc = fmt.Sprintf("%s %s [repo_path: %s]", c.name, strings.Join(c.args[c.globalArgsLength:], " "), rc.Dir)
}
ctx, cancel, finished := process.GetManager().AddContextTimeout(c.parentContext, rc.Timeout, desc)