mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	Change git.cmd to RunWithContext (#18693)
Change all `cmd...Pipeline` commands to `cmd.RunWithContext`. #18553 Co-authored-by: Martin Scholz <martin.scholz@versasec.com>
This commit is contained in:
		@@ -301,9 +301,12 @@ func GetAffectedFiles(repo *Repository, oldCommitID, newCommitID string, env []s
 | 
			
		||||
 | 
			
		||||
	// Run `git diff --name-only` to get the names of the changed files
 | 
			
		||||
	err = NewCommand(repo.Ctx, "diff", "--name-only", oldCommitID, newCommitID).
 | 
			
		||||
		RunInDirTimeoutEnvFullPipelineFunc(env, -1, repo.Path,
 | 
			
		||||
			stdoutWriter, nil, nil,
 | 
			
		||||
			func(ctx context.Context, cancel context.CancelFunc) error {
 | 
			
		||||
		RunWithContext(&RunContext{
 | 
			
		||||
			Env:     env,
 | 
			
		||||
			Timeout: -1,
 | 
			
		||||
			Dir:     repo.Path,
 | 
			
		||||
			Stdout:  stdoutWriter,
 | 
			
		||||
			PipelineFunc: func(ctx context.Context, cancel context.CancelFunc) error {
 | 
			
		||||
				// Close the writer end of the pipe to begin processing
 | 
			
		||||
				_ = stdoutWriter.Close()
 | 
			
		||||
				defer func() {
 | 
			
		||||
@@ -320,7 +323,8 @@ func GetAffectedFiles(repo *Repository, oldCommitID, newCommitID string, env []s
 | 
			
		||||
					affectedFiles = append(affectedFiles, path)
 | 
			
		||||
				}
 | 
			
		||||
				return scanner.Err()
 | 
			
		||||
			})
 | 
			
		||||
			},
 | 
			
		||||
		})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		log.Error("Unable to get affected files for commits from %s to %s in %s: %v", oldCommitID, newCommitID, repo.Path, err)
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user