mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Do not include global arguments in process manager (#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 <art27@cantab.net>
This commit is contained in:
		@@ -36,6 +36,7 @@ type Command struct {
 | 
			
		||||
	args             []string
 | 
			
		||||
	parentContext    context.Context
 | 
			
		||||
	desc             string
 | 
			
		||||
	globalArgsLength int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (c *Command) String() string {
 | 
			
		||||
@@ -54,6 +55,7 @@ func NewCommand(ctx context.Context, args ...string) *Command {
 | 
			
		||||
		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)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user