Skip to content

Commit fd0ed10

Browse files
committed
Do not include global arguments in process manager (go-gitea#19226)
Backport go-gitea#19226 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. Signed-off-by: Andrew Thornton <[email protected]>
1 parent 43c1f91 commit fd0ed10

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

modules/git/command.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,11 @@ const DefaultLocale = "C"
3333

3434
// Command represents a command with its subcommands or arguments.
3535
type Command struct {
36-
name string
37-
args []string
38-
parentContext context.Context
39-
desc string
36+
name string
37+
args []string
38+
parentContext context.Context
39+
desc string
40+
globalArgsLength int
4041
}
4142

4243
func (c *Command) String() string {
@@ -57,9 +58,10 @@ func NewCommandContext(ctx context.Context, args ...string) *Command {
5758
cargs := make([]string, len(GlobalCommandArgs))
5859
copy(cargs, GlobalCommandArgs)
5960
return &Command{
60-
name: GitExecutable,
61-
args: append(cargs, args...),
62-
parentContext: ctx,
61+
name: GitExecutable,
62+
args: append(cargs, args...),
63+
parentContext: ctx,
64+
globalArgsLength: len(globalCommandArgs),
6365
}
6466
}
6567

@@ -146,7 +148,7 @@ func (c *Command) RunWithContext(rc *RunContext) error {
146148

147149
desc := c.desc
148150
if desc == "" {
149-
args := c.args
151+
args := c.args[c.globalArgsLength:]
150152
var argSensitiveURLIndexes []int
151153
for i, arg := range c.args {
152154
if strings.Contains(arg, "://") && strings.Contains(arg, "@") {

0 commit comments

Comments
 (0)