Skip to content

Commit 4f9979a

Browse files
committed
Fix incorrect diff expander for deletion of last lines in a file
Fixes: go-gitea#29498
1 parent c7dcb58 commit 4f9979a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

services/gitdiff/gitdiff.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ func (d *DiffLine) GetBlobExcerptQuery() string {
154154

155155
// GetExpandDirection gets DiffLineExpandDirection
156156
func (d *DiffLine) GetExpandDirection() DiffLineExpandDirection {
157-
if d.Type != DiffLineSection || d.SectionInfo == nil || d.SectionInfo.RightIdx-d.SectionInfo.LastRightIdx <= 1 {
157+
if d.Type != DiffLineSection || d.SectionInfo == nil || d.SectionInfo.RightIdx-d.SectionInfo.LastRightIdx <= 1 || d.SectionInfo.LeftIdx-d.SectionInfo.LastLeftIdx <= 1 {
158158
return DiffLineExpandNone
159159
}
160160
if d.SectionInfo.LastLeftIdx <= 0 && d.SectionInfo.LastRightIdx <= 0 {

0 commit comments

Comments
 (0)