aboutsummaryrefslogtreecommitdiffstats
path: root/services/gitdiff
diff options
context:
space:
mode:
authorLauris BH <lauris@nix.lv>2020-01-22 09:20:58 +0200
committerGitHub <noreply@github.com>2020-01-22 09:20:58 +0200
commit3185a13ea5ba9b391f5f944d27f019459862cb33 (patch)
treea055defafc4105536a87b671fb44bca5b102ee58 /services/gitdiff
parentc7fe028db4a98ef48f9b5ffd07fcc13d49f5e3b1 (diff)
downloadgitea-3185a13ea5ba9b391f5f944d27f019459862cb33.tar.gz
gitea-3185a13ea5ba9b391f5f944d27f019459862cb33.zip
Check if diff actually contains sections when rendering (#9926)
Diffstat (limited to 'services/gitdiff')
-rw-r--r--services/gitdiff/gitdiff.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/services/gitdiff/gitdiff.go b/services/gitdiff/gitdiff.go
index b8efa8a43f..fc55c03595 100644
--- a/services/gitdiff/gitdiff.go
+++ b/services/gitdiff/gitdiff.go
@@ -344,7 +344,7 @@ func (diffFile *DiffFile) GetHighlightClass() string {
// GetTailSection creates a fake DiffLineSection if the last section is not the end of the file
func (diffFile *DiffFile) GetTailSection(gitRepo *git.Repository, leftCommitID, rightCommitID string) *DiffSection {
- if diffFile.Type != DiffFileChange || diffFile.IsBin || diffFile.IsLFSFile {
+ if len(diffFile.Sections) == 0 || diffFile.Type != DiffFileChange || diffFile.IsBin || diffFile.IsLFSFile {
return nil
}
leftCommit, err := gitRepo.GetCommit(leftCommitID)