diff: show diff type
Anirudh Oppiliappan x@icyphox.sh
PGP Signature
-----BEGIN PGP SIGNATURE----- iQEzBAABCgAdFiEE/huPz+bBYiLxVxyOipP5b3jF1MQFAmOgWw8ACgkQipP5b3jF 1MS1awf/Zm0AY+SGfCBThqkcgueu9ALdFglCVB1i6abNN6tDAeF3oZuI1KPoc9VO zm8cfCGiyofr6GF9/bw5ulixOm5DWckAosIvX/oJjtMOqhuboqym0UF3qKqDciMd pC9Qs/Lw0N903vy1REc8rLF9pPl276qnKCXxYTQeIHPqKyvV2Kv4ZWf2/NgHwyhQ qDLE9gEumYjFVIHp++5AqJ0KI+ou1jfHBWsHU8gngPzmwLV9p9PSfS9bOXC5yteI rVhjmFnaUTQpD2bTNCjErNTxpiMGC+WOqdgYKb3J5W9rsUR4LeUbnf8vr1aFiUqt go1R9wTwEfSN6kPBamwsK5R6sL0U8A== =DSFo -----END PGP SIGNATURE-----
3 files changed,
18 insertions(+),
1 deletions(-)
M
git/diff.go
→
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 ndiff.IsBinary = d.IsBinary + ndiff.IsNew = d.IsNew + ndiff.IsDelete = d.IsDelete for _, tf := range d.TextFragments { ndiff.TextFragments = append(ndiff.TextFragments, TextFragment{
M
static/style.css
→
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
→
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 }} + <span class="diff-type">D</span> + {{ end }} + {{ if not (or .IsNew .IsDelete) }} + <span class="diff-type">M</span> + {{ end }} {{ if .Name.Old }} <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.Old }}">{{ .Name.Old }}</a> {{ if .Name.New }}