all repos

mugit @ 3ab5d0aafc20240a0b3ea56f7b23c1654a13a839

🐮 git server that your cow will love
2 files changed, 26 insertions(+), 32 deletions(-)
ui: show added content in first commit
Author: Oleksandr Smirnov olexsmir@gmail.com
Committed at: 2026-02-26 21:22:23 +0200
Change ID: sxuzmuprnkysxyzumvmnlmktrmpvlllt
Parent: f9a31fe
M internal/git/diff.go

@@ -22,6 +22,7 @@ TextFragments []TextFragment

IsBinary bool IsNew bool IsDelete bool + IsRename bool } type NiceDiff struct {

@@ -65,6 +66,7 @@ }

diff.IsBinary = d.IsBinary diff.IsNew = d.IsNew diff.IsDelete = d.IsDelete + diff.IsRename = d.IsRename for _, tf := range d.TextFragments { diff.TextFragments = append(diff.TextFragments, TextFragment{
M web/templates/repo_commit.html

@@ -45,13 +45,15 @@ <strong>Change ID:</strong>

{{ $commit.ChangeID }} </div> {{- end }} + {{ if $parents }} <div> <strong>Parent:</strong> {{ range $i, $p := $parents -}} {{ if $i }}, {{ end -}} - <a class="link" href="/{{$.RepoName}}/commit/{{ $p }}">{{ $p }}</a> + <a class="link" href="/{{ $.RepoName }}/commit/{{ $p }}">{{ $p }}</a> {{- end }} </div> + {{ end }} </div> {{ if gt (len $diff) 1 -}}

@@ -64,13 +66,14 @@ {{ $path := .Name.New }}

{{ if not $path }}{{ $path = .Name.Old }}{{ end }} <tr> <td class="diff-type"> - {{ if .IsNew }}<span class="diff-type diff-add">A</span>{{ end }} - {{ if .IsDelete }}<span class="diff-type diff-del">D</span>{{ end }} - {{ if not (or .IsNew .IsDelete) }}<span class="diff-type diff-mod">M</span>{{ end }} + {{ if .IsNew }}<span class="diff-type diff-add">A</span> + {{ else if .IsDelete }}<span class="diff-type diff-del">D</span> + {{ else }}<span class="diff-type diff-mod">M</span>{{ end }} </td> <td class="fill"> <a href="#{{ $path }}"> - {{ if and .Name.Old .Name.New }}{{ .Name.Old }} &#8594; {{ .Name.New }}{{ else }}{{ $path }}{{ end }} + {{ if .IsRename }}{{ .Name.Old }} &#8594; {{ .Name.New }} + {{ else }}{{ $path }}{{ end }} </a> </td> </tr>

@@ -80,32 +83,26 @@ </table>

</div> {{ end }} </section> + <section> {{ $this := $commit.Hash }} - {{ $parent := index $parents 0 }} + {{ $parent := "" }} + {{ if $parents }}{{ $parent = index $parents 0 }}{{ end }} {{ range $diff }} {{ $path := .Name.New }} {{ if not $path }}{{ $path = .Name.Old }}{{ end }} <div id="{{ $path }}"> <div class="diff"> - {{ if .IsNew }} - <span class="diff-type diff-add">A</span> - {{ end }} - {{ if .IsDelete }} - <span class="diff-type diff-del">D</span> - {{ end }} - {{ if not (or .IsNew .IsDelete) }} - <span class="diff-type diff-mod">M</span> - {{ end }} - {{ if .Name.Old }} - <a href="/{{$.RepoName}}/blob/{{ $parent }}/{{ .Name.Old }}">{{ .Name.Old }}</a> - {{ if .Name.New }} - &#8594; - <a href="/{{$.RepoName}}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a> + {{ if .IsNew }}<span class="diff-type diff-add">A</span> + {{ else if .IsDelete }}<span class="diff-type diff-del">D</span> + {{ else }}<span class="diff-type diff-mod">M</span>{{ end }} + + {{ if .IsNew }}<a href="/{{ $.RepoName }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>{{ else }} + {{ if $parent }}<a href="/{{ $.RepoName }}/blob/{{ $parent }}/{{ .Name.Old }}">{{ .Name.Old }}</a> + {{ else }}{{ .Name.Old }}{{ end }} + {{ if .IsRename }}&#8594;<a href="/{{ $.RepoName }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>{{ end }} {{ end }} - {{ else }} - <a href="/{{$.RepoName}}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a> - {{- end -}} + {{ if .IsBinary }} <p>Not showing binary file.</p> {{ else }}

@@ -113,19 +110,14 @@ <pre>

{{- range .TextFragments -}} <p>{{- .Header -}}</p> {{- range .Lines -}} - {{- if eq .Op.String "+" -}} - <span class="diff-add">{{ .String }}</span> - {{- end -}} - {{- if eq .Op.String "-" -}} - <span class="diff-del">{{ .String }}</span> - {{- end -}} - {{- if eq .Op.String " " -}} - <span class="diff-noop">{{ .String }}</span> - {{- end -}} + {{- if eq .Op.String "+" -}}<span class="diff-add">{{ .String }}</span> + {{- else if eq .Op.String "-" -}}<span class="diff-del">{{ .String }}</span> + {{- else -}}<span class="diff-noop">{{ .String }}</span> {{- end -}} {{- end -}} {{- end -}} </pre> + {{ end }} </div> </div> {{ end }}