mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-19 06:20:48 +02:00
Fix git diff hunk 0 based start line
This commit is contained in:
parent
b46623f6a5
commit
decc9624b7
@ -864,9 +864,9 @@ func parseHunks(ctx context.Context, curFile *DiffFile, maxLines, maxLineCharact
|
|||||||
}
|
}
|
||||||
curSection.Lines = append(curSection.Lines, diffLine)
|
curSection.Lines = append(curSection.Lines, diffLine)
|
||||||
curSection.FileName = curFile.Name
|
curSection.FileName = curFile.Name
|
||||||
// update line number.
|
// update line number. leftLine and rightLine are 1-based indexes, 0 means 1
|
||||||
leftLine = lineSectionInfo.LeftIdx
|
leftLine = max(lineSectionInfo.LeftIdx, 1)
|
||||||
rightLine = lineSectionInfo.RightIdx
|
rightLine = max(lineSectionInfo.RightIdx, 1)
|
||||||
continue
|
continue
|
||||||
case '\\':
|
case '\\':
|
||||||
if maxLines > -1 && curFileLinesCount >= maxLines {
|
if maxLines > -1 && curFileLinesCount >= maxLines {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user