mirror of
https://github.com/go-gitea/gitea
synced 2026-02-03 11:10:40 +00:00
Refactor git command stdio pipe (#36422)
Most potential deadlock problems should have been fixed, and new code is unlikely to cause new problems with the new design. Also raise the minimum Git version required to 2.6.0 (released in 2015)
This commit is contained in:
@@ -41,7 +41,7 @@ func (ctx *mergeContext) PrepareGitCmd(cmd *gitcmd.Command) *gitcmd.Command {
|
||||
return cmd.WithEnv(ctx.env).
|
||||
WithDir(ctx.tmpBasePath).
|
||||
WithParentCallerInfo().
|
||||
WithStdout(ctx.outbuf)
|
||||
WithStdoutBuffer(ctx.outbuf)
|
||||
}
|
||||
|
||||
// ErrSHADoesNotMatch represents a "SHADoesNotMatch" kind of error.
|
||||
@@ -219,11 +219,11 @@ func getDiffTree(ctx context.Context, repoPath, baseBranch, headBranch string, o
|
||||
return 0, nil, nil
|
||||
}
|
||||
|
||||
var diffOutReader io.ReadCloser
|
||||
err := gitcmd.NewCommand("diff-tree", "--no-commit-id", "--name-only", "-r", "-r", "-z", "--root").
|
||||
AddDynamicArguments(baseBranch, headBranch).
|
||||
cmd := gitcmd.NewCommand("diff-tree", "--no-commit-id", "--name-only", "-r", "-r", "-z", "--root")
|
||||
diffOutReader, diffOutReaderClose := cmd.MakeStdoutPipe()
|
||||
defer diffOutReaderClose()
|
||||
err := cmd.AddDynamicArguments(baseBranch, headBranch).
|
||||
WithDir(repoPath).
|
||||
WithStdoutReader(&diffOutReader).
|
||||
WithPipelineFunc(func(ctx gitcmd.Context) error {
|
||||
// Now scan the output from the command
|
||||
scanner := bufio.NewScanner(diffOutReader)
|
||||
|
||||
Reference in New Issue
Block a user