Commit 45b0f87
Changed files (3)
pkg
templates
pkg/templates/commit.gohtml
@@ -186,7 +186,9 @@
.binary-file {
padding: 8px 16px;
font-style: italic;
+ }
+ .border {
border: 1px solid var(--c-border);
border-top: none;
border-bottom-left-radius: 6px;
@@ -260,7 +262,9 @@
</header>
</div>
{{ if .IsBinary }}
- <div class="binary-file">Binary file</div>
+ <div class="binary-file border">Binary file</div>
+ {{ else if (and .IsRename (not .HasChanges)) }}
+ <div class="binary-file border">File renamed without changes</div>
{{ else }}
<div class="file-diff">
{{ .HTML }}
pkg/templates/templates.go
@@ -190,14 +190,15 @@ type FileTree struct {
// FileView represents a single file section on the commit page with its
// pre-rendered HTML diff and metadata used by the template.
type FileView struct {
- Path string
- OldName string
- NewName string
- IsNew bool
- IsDelete bool
- IsRename bool
- IsBinary bool
- HTML HTML // pre-rendered HTML for diff of this file
+ Path string
+ OldName string
+ NewName string
+ IsNew bool
+ IsDelete bool
+ IsRename bool
+ IsBinary bool
+ HasChanges bool
+ HTML HTML // pre-rendered HTML for diff of this file
}
type PreviewCard struct {
commit.go
@@ -202,14 +202,15 @@ func generateCommitPage(commit git.Commit, params Params) error {
}
filesViews = append(filesViews, templates.FileView{
- Path: path,
- OldName: f.OldName,
- NewName: f.NewName,
- IsNew: f.IsNew,
- IsDelete: f.IsDelete,
- IsRename: f.IsRename,
- IsBinary: f.IsBinary,
- HTML: template.HTML(buf.String()),
+ Path: path,
+ OldName: f.OldName,
+ NewName: f.NewName,
+ IsNew: f.IsNew,
+ IsDelete: f.IsDelete,
+ IsRename: f.IsRename,
+ IsBinary: f.IsBinary,
+ HasChanges: f.TextFragments != nil,
+ HTML: template.HTML(buf.String()),
})
}