mirror of
https://github.com/go-gitea/gitea.git
synced 2026-02-07 09:49:41 +09: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:
@@ -76,3 +76,26 @@ func IsErrorCanceledOrKilled(err error) bool {
|
||||
// TODO: in the future, we need to use unified error type from gitcmd.Run to check whether it is manually canceled
|
||||
return errors.Is(err, context.Canceled) || IsErrorSignalKilled(err)
|
||||
}
|
||||
|
||||
type pipelineError struct {
|
||||
error
|
||||
}
|
||||
|
||||
func (e pipelineError) Unwrap() error {
|
||||
return e.error
|
||||
}
|
||||
|
||||
func wrapPipelineError(err error) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
return pipelineError{err}
|
||||
}
|
||||
|
||||
func ErrorAsPipeline(err error) error {
|
||||
var pipelineErr pipelineError
|
||||
if errors.As(err, &pipelineErr) {
|
||||
return pipelineErr.error
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user