all repos — elgit @ 1375740735b2085d638b53d116c9efeb199ed4d6

fork of legit: web frontend for git, written in go

Link to parent commit file version in commit view

It makes sense for [oldfile] in [oldfile]->[newfile] to link to the
previous version. This is also how cgit behaves.
phire me@phire.cc
Tue, 20 Dec 2022 09:41:55 +0100
commit

1375740735b2085d638b53d116c9efeb199ed4d6

parent

e5d35c4deccd35a12b138d089dcd15a2c8ac18c1

1 files changed, 2 insertions(+), 1 deletions(-)

jump to
M templates/commit.htmltemplates/commit.html
@@ -45,6 +45,7 @@ </section>       <section>
         {{ $repo := .name }}
         {{ $this := .commit.This }}
+        {{ $parent := .commit.Parent }}
         {{ range .diff }}
           <div id="{{ .Name.New }}">
             <div class="diff">
@@ -58,7 +59,7 @@ {{ 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>
+          <a href="/{{ $repo }}/blob/{{ $parent }}/{{ .Name.Old }}">{{ .Name.Old }}</a>
           {{ if .Name.New }}
             &#8594; 
             <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a>