The git command by default adds a number of global arguments. These are not helpful to be displayed in the process manager and so should be skipped for default process descriptions.
Showing the changes to modules/git/command.go (1 of 1 file). Show all
Unified · Split
| @@ -32,10 +32,11 @@ const DefaultLocale = "C" · 31 unmodified lines | ||
| 32 | 32 | |
| 33 | 33 | // Command represents a command with its subcommands or arguments. |
| 34 | 34 | type Command struct { |
| 35 | − name string | |
| 36 | − args []string | |
| 37 | − parentContext context.Context | |
| 38 | − desc string | |
| 35 | + name string | |
| 36 | + args []string | |
| 37 | + parentContext context.Context | |
| 38 | + desc string | |
| 39 | + globalArgsLength int | |
| 39 | 40 | } |
| 40 | 41 | |
| 41 | 42 | func (c *Command) String() string { |
| @@ -51,9 +52,10 @@ func NewCommand(ctx context.Context, args ...string) *Command { · 9 unmodified lines | ||
| 51 | 52 | cargs := make([]string, len(globalCommandArgs)) |
| 52 | 53 | copy(cargs, globalCommandArgs) |
| 53 | 54 | return &Command{ |
| 54 | − name: GitExecutable, | |
| 55 | − args: append(cargs, args...), | |
| 56 | − parentContext: ctx, | |
| 55 | + name: GitExecutable, | |
| 56 | + args: append(cargs, args...), | |
| 57 | + parentContext: ctx, | |
| 58 | + globalArgsLength: len(globalCommandArgs), | |
| 57 | 59 | } |
| 58 | 60 | } |
| 59 | 61 | |
| @@ -140,7 +142,7 @@ func (c *Command) RunWithContext(rc *RunContext) error { · 80 unmodified lines | ||
| 140 | 142 | |
| 141 | 143 | desc := c.desc |
| 142 | 144 | if desc == "" { |
| 143 | − desc = fmt.Sprintf("%s %s [repo_path: %s]", c.name, strings.Join(c.args, " "), rc.Dir) | |
| 145 | + desc = fmt.Sprintf("%s %s [repo_path: %s]", c.name, strings.Join(c.args[c.globalArgsLength:], " "), rc.Dir) | |
| 144 | 146 | } |
| 145 | 147 | |
| 146 | 148 | ctx, cancel, finished := process.GetManager().AddContextTimeout(c.parentContext, rc.Timeout, desc) |