forked from gitea/gitea
1
0
Fork 0

Check if diff actually contains sections when rendering (#9926) (#9933)

This commit is contained in:
Lauris BH 2020-01-22 10:02:57 +02:00 committed by zeripath
parent 0dced15c1a
commit f82a805478
1 changed files with 1 additions and 1 deletions

View File

@ -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 // 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 { 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 return nil
} }
leftCommit, err := gitRepo.GetCommit(leftCommitID) leftCommit, err := gitRepo.GetCommit(leftCommitID)