Skip to content

Commit 17d5d1d

Browse files
committed
correct
1 parent 0ed2e89 commit 17d5d1d

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

modules/git/diff.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,11 +120,9 @@ func ParseDiffHunkString(diffHunk string) (leftLine, leftHunk, rightLine, rightH
120120
rightHunk = leftHunk
121121
}
122122
if rightLine == 0 {
123-
// "git diff" outputs 2 different formats for the same change "OLD" => "A\nB\nC"
124-
// * "@@ -1 +1,3 @@": the expected result
125-
// * "@@ -1,1 +0,4 @@": the "0" means "insert before the first line"
123+
// "git diff" outputs "@@ -1 +1,3 @@" for "OLD" => "A\nB\nC"
124+
// FIXME: GIT-DIFF-CUT-BUG But there is a but in CutDiffAroundLine, then the "Patch" stored in the comment model becomes "@@ -1,1 +0,4 @@"
126125
rightLine++
127-
rightHunk--
128126
}
129127
return leftLine, leftHunk, rightLine, rightHunk
130128
}
@@ -277,6 +275,7 @@ func CutDiffAroundLine(originalDiff io.Reader, line int64, old bool, numbersOfLi
277275
oldNumOfLines++
278276
}
279277
}
278+
// FIXME: GIT-DIFF-CUT-BUG search this tag to see details
280279
// construct the new hunk header
281280
newHunk[headerLines] = fmt.Sprintf("@@ -%d,%d +%d,%d @@",
282281
oldBegin, oldNumOfLines, newBegin, newNumOfLines)

0 commit comments

Comments
 (0)