mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-06 04:01:05 +09:00
Refactor pull request view (1) (#37380)
Refactor preparePullViewPullInfo and related functions, split them into small ones: * preparePullViewPullInfo creates PullRequestViewInfo struct * if the PR is merged: prepareView**Merged**PullInfo * if the PR is open: prepareView**Open**PullInfo In prepareViewMergedPullInfo and preparePullViewFillInfo: call preparePullView**FillInfo** consistnently preparePullViewFillInfo calls preparePullViewFill**CompareInfo** and preparePullViewFill**CommitStatusInfo**
This commit is contained in:
@@ -56,6 +56,14 @@ func StderrHasPrefix(err error, prefix string) bool {
|
||||
return strings.HasPrefix(stderr, prefix)
|
||||
}
|
||||
|
||||
func StderrContains(err error, sub string) bool {
|
||||
stderr, ok := ErrorAsStderr(err)
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
return strings.Contains(stderr, sub)
|
||||
}
|
||||
|
||||
func IsErrorExitCode(err error, code int) bool {
|
||||
var exitError *exec.ExitError
|
||||
if errors.As(err, &exitError) {
|
||||
|
||||
Reference in New Issue
Block a user