From 1375740735b2085d638b53d116c9efeb199ed4d6 Mon Sep 17 00:00:00 2001 From: phire <me@phire.cc> Date: Tue, 20 Dec 2022 09:41:55 +0100 Subject: 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. --- templates/commit.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/templates/commit.html b/templates/commit.html index f0c58dc..440204b 100644 --- a/templates/commit.html +++ b/templates/commit.html @@ -45,6 +45,7 @@ <section> {{ $repo := .name }} {{ $this := .commit.This }} + {{ $parent := .commit.Parent }} {{ range .diff }} <div id="{{ .Name.New }}"> <div class="diff"> @@ -58,7 +59,7 @@ <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 }} → <a href="/{{ $repo }}/blob/{{ $this }}/{{ .Name.New }}">{{ .Name.New }}</a> -- cgit v1.2.3