diff options
author | KN4CK3R <admin@oldschoolhack.me> | 2021-06-24 17:47:46 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-24 17:47:46 +0200 |
commit | 4cc63e9919486581f7acc49829ebf21bc52dd871 (patch) | |
tree | 026d7784462055d3dd4149e414f4053c215081df /routers | |
parent | 71c5a8f7f8b127c559115a6bbbfe6372ecf6dd10 (diff) | |
download | gitea-4cc63e9919486581f7acc49829ebf21bc52dd871.tar.gz gitea-4cc63e9919486581f7acc49829ebf21bc52dd871.zip |
Fix diff expansion is missing final line in a file (#16222)
* Fixed down offset.
* Fixed wrong line count result.
Diffstat (limited to 'routers')
-rw-r--r-- | routers/web/repo/compare.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/routers/web/repo/compare.go b/routers/web/repo/compare.go index f53a31769d..fddfc4a63a 100644 --- a/routers/web/repo/compare.go +++ b/routers/web/repo/compare.go @@ -714,7 +714,11 @@ func ExcerptBlob(ctx *context.Context) { lastLeft += chunkSize lastRight += chunkSize } else { - section.Lines, err = getExcerptLines(commit, filePath, lastLeft, lastRight, idxRight-lastRight-1) + offset := -1 + if direction == "down" { + offset = 0 + } + section.Lines, err = getExcerptLines(commit, filePath, lastLeft, lastRight, idxRight-lastRight+offset) leftHunkSize = 0 rightHunkSize = 0 idxLeft = lastLeft |