From 569b27838254cb4a7bf54a4a3af7c829845442b3 Mon Sep 17 00:00:00 2001 From: Gusted Date: Sun, 17 Sep 2023 20:25:30 +0200 Subject: [PATCH] [GITEA] Skip unsupported code comment - If there's a code comment that's received during the migration that contains no diffhunk, skip it. This either means it was commenting on old diffhunk or it's just a general codecomment. Forgejo supports neither of such type of code comment. - Resolves https://codeberg.org/forgejo/forgejo/issues/1407 (cherry picked from commit ae463c7c559e02975ce5e758d8780def978eebee) (cherry picked from commit bf48f02a86d6a193417f13a77031b8207a173dca) (cherry picked from commit 10c3f102fa9135de37e9f73137ae5a9cf7072635) (cherry picked from commit 828b4cc10cd0fc7e2540fe75e88b6ebf978c5c84) (cherry picked from commit 6427fa65b641a32ead53779e3e7bda97704567df) (cherry picked from commit 5b7a43c43fed0eb39e84edd652a699461f14fbbb) (cherry picked from commit 4eef0fce72894fba2a8a138836421588f96f1087) (cherry picked from commit a46192a4a6cffa1122ffc0c4781ba93c3067b05d) (cherry picked from commit 107a9b8233731b3ac2d3a5474795a227c5bb8c0d) (cherry picked from commit 308251fc48b674e58d27acf1ccf1bc00b5fe2d54) (cherry picked from commit 017c4a53c5c8e3e2f1a1d8a06b1f975697584973) (cherry picked from commit 4534a3393b5a6beb500eb36d92ac87dda485b984) (cherry picked from commit 74e0c1663d27afc98b77c59db9f9a1593f7ea766) (cherry picked from commit 9b17353f85c4f6273aec64996e70594fc2b8f37e) (cherry picked from commit 09b6f58304f526c2fc8c9aeecf238b8bfa9ab1c5) (cherry picked from commit bc649733a121503bd2c8855a7bcac5bfce883363) (cherry picked from commit f1d4c783e272b10d3193e78e0bbbca1b2f7ef75c) (cherry picked from commit d6850bc3087ba40e61099700be97818501472cbe) (cherry picked from commit 21230d2d24dc9c96811891e55e2bb4974f8940ca) --- services/migrations/gitea_uploader.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/services/migrations/gitea_uploader.go b/services/migrations/gitea_uploader.go index 7b21d9f4d2..0f0ca7e0f5 100644 --- a/services/migrations/gitea_uploader.go +++ b/services/migrations/gitea_uploader.go @@ -861,6 +861,11 @@ func (g *GiteaLocalUploader) CreateReviews(reviews ...*base.Review) error { } for _, comment := range review.Comments { + // Skip code comment if it doesn't have a diff it is commeting on. + if comment.DiffHunk == "" { + continue + } + line := comment.Line if line != 0 { comment.Position = 1