Skip to content

Commit f82a805

Browse files
lafrikszeripath
authored andcommitted
Check if diff actually contains sections when rendering (#9926) (#9933)
1 parent 0dced15 commit f82a805

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
@@ -344,7 +344,7 @@ func (diffFile *DiffFile) GetHighlightClass() string {
344344

345345
// GetTailSection creates a fake DiffLineSection if the last section is not the end of the file
346346
func (diffFile *DiffFile) GetTailSection(gitRepo *git.Repository, leftCommitID, rightCommitID string) *DiffSection {
347-
if diffFile.Type != DiffFileChange || diffFile.IsBin || diffFile.IsLFSFile {
347+
if len(diffFile.Sections) == 0 || diffFile.Type != DiffFileChange || diffFile.IsBin || diffFile.IsLFSFile {
348348
return nil
349349
}
350350
leftCommit, err := gitRepo.GetCommit(leftCommitID)

0 commit comments

Comments
 (0)