git-preview @ main

static git web frontend but with images and html previews + code truncation

diff: show diff type
Mon, 19 Dec 2022
3 files changed, 18 insertions(+), 1 deletions(-)
M git/diff.go

@@ -21,6 +21,8 @@ New string

} TextFragments []TextFragment IsBinary bool + IsNew bool + IsDelete bool } // A nicer git diff representation.

@@ -90,6 +92,8 @@ ndiff := Diff{}

ndiff.Name.New = d.NewName ndiff.Name.Old = d.OldName

… preview truncated

M static/style.css

@@ -238,6 +238,10 @@ background: var(--light-gray);

overflow: scroll; } +.diff-type { + color: var(--gray); +} + .commit-info { color: var(--gray); padding-bottom: 1.5rem;
M templates/commit.html

@@ -46,8 +46,17 @@ <section>

{{ $repo := .name }} {{ $this := .commit.This }} {{ range .diff }} - <div class="diff"> <div id="{{ .Name.New }}"> + <div class="diff"> + {{ if .IsNew }} + <span class="diff-type">A</span> + {{ end }} + {{ if .IsDelete }}

… preview truncated