From d11faa53bb3eb6109d052f686e5304c380f6461a Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Sat, 12 Jul 2025 01:24:51 +0800 Subject: [PATCH] more bug comment --- modules/git/diff.go | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/git/diff.go b/modules/git/diff.go index d4a3902727..35d115be0e 100644 --- a/modules/git/diff.go +++ b/modules/git/diff.go @@ -279,6 +279,7 @@ func CutDiffAroundLine(originalDiff io.Reader, line int64, old bool, numbersOfLi // "git diff" outputs "@@ -1 +1,3 @@" for "OLD" => "A\nB\nC" // FIXME: GIT-DIFF-CUT-BUG But there is a bug in CutDiffAroundLine, then the "Patch" stored in the comment model becomes "@@ -1,1 +0,4 @@" // It may generate incorrect results for difference cases, for example: delete 2 line add 1 line, delete 2 line add 2 line etc, need to double check. + // For example: "L1\nL2" => "A\nB", then the patch shows "L2" as line 1 on the left (deleted part) // construct the new hunk header newHunk[headerLines] = fmt.Sprintf("@@ -%d,%d +%d,%d @@",