diff options
author | chavacava <salvadorcavadini+github@gmail.com> | 2022-04-15 16:50:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-15 22:50:09 +0800 |
commit | deffe9e5258bac233472b57166be17bc48a527c9 (patch) | |
tree | 56a9aa2876bb9301e5c1f55f364b9d12ec816542 /services | |
parent | 9053096f1f62d155a60431093aea062ac784eba6 (diff) | |
download | gitea-deffe9e5258bac233472b57166be17bc48a527c9.tar.gz gitea-deffe9e5258bac233472b57166be17bc48a527c9.zip |
Fix datarace in gitea_uploader.go (#19409)
Diffstat (limited to 'services')
-rw-r--r-- | services/migrations/gitea_uploader.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/services/migrations/gitea_uploader.go b/services/migrations/gitea_uploader.go index 8529f24895..275b7026a0 100644 --- a/services/migrations/gitea_uploader.go +++ b/services/migrations/gitea_uploader.go @@ -754,13 +754,13 @@ func (g *GiteaLocalUploader) CreateReviews(reviews ...*base.Review) error { _ = reader.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 { // 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) } _ = writer.Close() - }() + }(comment) patch, _ = git.CutDiffAroundLine(reader, int64((&models.Comment{Line: int64(line + comment.Position - 1)}).UnsignedLine()), line < 0, setting.UI.CodeCommentLines) |