diff --git a/models/git_diff.go b/models/git_diff.go index d9bb5e9d9..1f514de4f 100644 --- a/models/git_diff.go +++ b/models/git_diff.go @@ -366,10 +366,12 @@ func ParsePatch(maxLines, maxLineCharacters, maxFiles int, reader io.Reader) (*D } curFile = &DiffFile{ - Name: a, - Index: len(diff.Files) + 1, - Type: DiffFileChange, - Sections: make([]*DiffSection, 0, 10), + Name: b, + OldName: a, + Index: len(diff.Files) + 1, + Type: DiffFileChange, + Sections: make([]*DiffSection, 0, 10), + IsRenamed: a != b, } diff.Files = append(diff.Files, curFile) if len(diff.Files) >= maxFiles { @@ -402,9 +404,6 @@ func ParsePatch(maxLines, maxLineCharacters, maxFiles int, reader io.Reader) (*D curFile.Type = DiffFileChange case strings.HasPrefix(line, "similarity index 100%"): curFile.Type = DiffFileRename - curFile.IsRenamed = true - curFile.OldName = curFile.Name - curFile.Name = b } if curFile.Type > 0 { if strings.HasSuffix(line, " 160000\n") { diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 90def1f84..40675d75b 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -78,7 +78,7 @@ {{end}}