{{ define "title" }} commit {{ .Diff.Commit.This }} · {{ .RepoInfo.FullName }} {{ end }} {{ define "repoContent" }} {{ $repo := .RepoInfo.FullName }} {{ $commit := .Diff.Commit }} {{ $stat := .Diff.Stat }} {{ $diff := .Diff.Diff }}
{{ $messageParts := splitN $commit.Message "\n\n" 2 }}

{{ index $messageParts 0 }}

{{ if gt (len $messageParts) 1 }}

{{ nl2br (unwrapText (index $messageParts 1)) }}

{{ end }}

{{ $commit.Author.Name }} {{ timeFmt $commit.Author.When }} {{ $stat.FilesChanged }} files (+{{ $stat.Insertions }}, -{{ $stat.Deletions }})

{{ slice $commit.This 0 8 }} {{ if $commit.Parent }} {{ slice $commit.Parent 0 8 }} {{ end }}


Changed files {{ range $diff }} {{ end }}
{{end}} {{ define "repoAfter" }} {{ $repo := .RepoInfo.FullName }} {{ $commit := .Diff.Commit }} {{ $stat := .Diff.Stat }} {{ $diff := .Diff.Diff }} {{ $this := $commit.This }} {{ $parent := $commit.Parent }} {{ $last := sub (len $diff) 1 }} {{ range $idx, $hunk := $diff }} {{ with $hunk }}
{{ $markerstyle := "diff-type p-1 mr-1 font-mono text-sm rounded select-none" }} {{ if .IsNew }} ADDED {{ else if .IsDelete }} DELETED {{ else if .IsCopy }} COPIED {{ else if .IsRename }} RENAMED {{ else }} MODIFIED {{ end }} {{ if .IsDelete }} {{ .Name.Old }} {{ else if (or .IsCopy .IsRename) }} {{ .Name.Old }} {{ .Name.New }} {{ else }} {{ .Name.New }} {{ end }}
{{ $iconstyle := "p-1 mx-1 hover:bg-gray-100 rounded" }}
{{ if gt $idx 0 }} {{ $prev := index $diff (sub $idx 1) }} {{ end }} {{ if lt $idx $last }} {{ $next := index $diff (add $idx 1) }} {{ end }}
{{ if .IsDelete }}

This file has been deleted in this commit.

{{ else }} {{ if .IsBinary }}

This is a binary file and will not be displayed.

{{ else }}
              {{- range .TextFragments -}}
                
{{ .Header }}
{{- range .Lines -}} {{- if eq .Op.String "+" -}}
{{ .Op.String }}{{ .Line }}
{{- end -}} {{- if eq .Op.String "-" -}}
{{ .Op.String }}{{ .Line }}
{{- end -}} {{- if eq .Op.String " " -}}
{{ .Op.String }}{{ .Line }}
{{- end -}} {{- end -}} {{- end -}}
{{- end -}} {{ end }}
{{ end }} {{ end }} {{end}}