From 0d3a759fdca41380e5d880e6b7cfc10770d48987 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20B=C3=BCchau?= Date: Wed, 5 Feb 2025 17:43:27 +0000 Subject: [PATCH] feat: Allow opening a single-file diff from file history view (#6599) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This PR adds a small icon link to the file history list to open the diff for *only* this file in the respective commit. This is very useful if the commit in question touches a very large amount of files and finding the actual file in the diff is tedious. - fixes #6596 Co-authored-by: Gusted Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6599 Reviewed-by: Gusted Co-authored-by: Yann Büchau Co-committed-by: Yann Büchau --- options/locale/locale_en-US.ini | 1 + templates/repo/commits_list.tmpl | 8 ++++++++ tests/integration/view_test.go | 5 ++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 12a66773ca..5f945f0d0f 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1453,6 +1453,7 @@ commits.signed_by_untrusted_user_unmatched = Signed by untrusted user who does n commits.gpg_key_id = GPG key ID commits.ssh_key_fingerprint = SSH key fingerprint commits.view_path=View at this point in history +commits.view_single_diff = View changes to this file introduced in this commit commit.operations = Operations commit.revert = Revert diff --git a/templates/repo/commits_list.tmpl b/templates/repo/commits_list.tmpl index b23de20583..a9015e6089 100644 --- a/templates/repo/commits_list.tmpl +++ b/templates/repo/commits_list.tmpl @@ -81,6 +81,14 @@ {{if not $.PageIsWiki}} + {{if $.FileName}} + + {{svg "octicon-file-diff"}} + + {{end}}