mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-20 12:47:13 +00:00
Fix datarace in gitea_uploader.go (#19409)
This commit is contained in:
parent
9053096f1f
commit
deffe9e525
|
@ -754,13 +754,13 @@ func (g *GiteaLocalUploader) CreateReviews(reviews ...*base.Review) error {
|
||||||
_ = reader.Close()
|
_ = reader.Close()
|
||||||
_ = writer.Close()
|
_ = writer.Close()
|
||||||
}()
|
}()
|
||||||
go func() {
|
go func(comment *base.ReviewComment) {
|
||||||
if err := git.GetRepoRawDiffForFile(g.gitRepo, pr.MergeBase, headCommitID, git.RawDiffNormal, comment.TreePath, writer); err != nil {
|
if err := git.GetRepoRawDiffForFile(g.gitRepo, pr.MergeBase, headCommitID, git.RawDiffNormal, comment.TreePath, writer); err != nil {
|
||||||
// We should ignore the error since the commit maybe removed when force push to the pull request
|
// We should ignore the error since the commit maybe removed when force push to the pull request
|
||||||
log.Warn("GetRepoRawDiffForFile failed when migrating [%s, %s, %s, %s]: %v", g.gitRepo.Path, pr.MergeBase, headCommitID, comment.TreePath, err)
|
log.Warn("GetRepoRawDiffForFile failed when migrating [%s, %s, %s, %s]: %v", g.gitRepo.Path, pr.MergeBase, headCommitID, comment.TreePath, err)
|
||||||
}
|
}
|
||||||
_ = writer.Close()
|
_ = writer.Close()
|
||||||
}()
|
}(comment)
|
||||||
|
|
||||||
patch, _ = git.CutDiffAroundLine(reader, int64((&models.Comment{Line: int64(line + comment.Position - 1)}).UnsignedLine()), line < 0, setting.UI.CodeCommentLines)
|
patch, _ = git.CutDiffAroundLine(reader, int64((&models.Comment{Line: int64(line + comment.Position - 1)}).UnsignedLine()), line < 0, setting.UI.CodeCommentLines)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue