gitea/services/gitdiff
silverwind 3b99066aa8
Fix incorrect diff expander for deletion of last lines in a file ()
Fixes: https://github.com/go-gitea/gitea/issues/29498

I don't quite understand this code, but this change does seem to fix the
issue and I tested a number of diffs with it and saw no issue. The
function gets such value if last line is an addition:

```
  LastLeftIdx: (int) 0,
  LastRightIdx: (int) 47,
  LeftIdx: (int) 47,
  RightIdx: (int) 48,
```

If it's a deletion, it gets:

```
  LastLeftIdx: (int) 47,
  LastRightIdx: (int) 0,
  LeftIdx: (int) 48,
  RightIdx: (int) 47,
```

So I think it's correct to make this check respect both left and right
side.
..
testdata/academic-module rm .sample hooks which aren't used ()
csv.go Use Go 1.21 and update dependencies ()
csv_test.go Even more `db.DefaultContext` refactor ()
gitdiff.go Fix incorrect diff expander for deletion of last lines in a file ()
gitdiff_test.go Even more `db.DefaultContext` refactor ()
highlightdiff.go Add option to disable ambiguous unicode characters detection ()
highlightdiff_test.go Implement FSFE REUSE for golang files ()
main_test.go make writing main test easier ()