fix: refactor git error handling and make archive streaming handle non-existing commit id (#38007)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
Sandro
2026-06-06 11:06:08 +00:00
committed by GitHub
co-authored by wxiaoguang
parent e88650cfcf
commit 743bbaa9c2
10 changed files with 57 additions and 50 deletions
+1 -1
View File
@@ -1435,7 +1435,7 @@ func GetPullRequestCommits(ctx *context.APIContext) {
compareInfo, err = git_service.GetCompareInfo(ctx, pr.BaseRepo, pr.BaseRepo, baseGitRepo, git.RefNameFromBranch(pr.BaseBranch), git.RefName(pr.GetGitHeadRefName()), false, false)
}
if gitcmd.StderrHasPrefix(err, "fatal: bad revision") {
if gitcmd.IsStderr(err, gitcmd.StderrBadRevision) {
ctx.APIError(http.StatusNotFound, "invalid base branch or revision")
return
} else if err != nil {