summaryrefslogtreecommitdiffstats
path: root/templates/repo/blame.tmpl
diff options
context:
space:
mode:
authorKN4CK3R <admin@oldschoolhack.me>2023-09-16 19:42:34 +0200
committerGitHub <noreply@github.com>2023-09-16 17:42:34 +0000
commited64f1c2b835bf9332bf8347be9675ef29c8274b (patch)
treed549801f35652496808d7307403f86e2f3f1ff39 /templates/repo/blame.tmpl
parentc766140dad3408048ad843d0e7b4ab5d9f5777c6 (diff)
downloadgitea-ed64f1c2b835bf9332bf8347be9675ef29c8274b.tar.gz
gitea-ed64f1c2b835bf9332bf8347be9675ef29c8274b.zip
Support `.git-blame-ignore-revs` file (#26395)
Closes #26329 This PR adds the ability to ignore revisions specified in the `.git-blame-ignore-revs` file in the root of the repository. ![grafik](https://github.com/go-gitea/gitea/assets/1666336/9e91be0c-6e9c-431c-bbe9-5f80154251c8) The banner is displayed in this case. I intentionally did not add a UI way to bypass the ignore file (same behaviour as Github) but you can add `?bypass-blame-ignore=true` to the url manually. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'templates/repo/blame.tmpl')
-rw-r--r--templates/repo/blame.tmpl12
1 files changed, 12 insertions, 0 deletions
diff --git a/templates/repo/blame.tmpl b/templates/repo/blame.tmpl
index b253c4d901..3078e9bef3 100644
--- a/templates/repo/blame.tmpl
+++ b/templates/repo/blame.tmpl
@@ -1,3 +1,15 @@
+{{if or .UsesIgnoreRevs .FaultyIgnoreRevsFile}}
+ {{$revsFileLink := URLJoin .RepoLink "src" .BranchNameSubURL "/.git-blame-ignore-revs"}}
+ {{if .UsesIgnoreRevs}}
+ <div class="ui info message">
+ <p>{{.locale.Tr "repo.blame.ignore_revs" $revsFileLink (print $revsFileLink "?bypass-blame-ignore=true") | Str2html}}</p>
+ </div>
+ {{else}}
+ <div class="ui error message">
+ <p>{{.locale.Tr "repo.blame.ignore_revs.failed" $revsFileLink | Str2html}}</p>
+ </div>
+ {{end}}
+{{end}}
<div class="{{TabSizeClass .Editorconfig .FileName}} non-diff-file-content">
<h4 class="file-header ui top attached header gt-df gt-ac gt-sb gt-fw">
<div class="file-header-left gt-df gt-ac gt-py-3 gt-pr-4">