Skip to content

Commit 9dcf0bf

Browse files
Gustedzeripath
Gusted
andauthored
Fix commit links on compare page (#18310)
* Fix commit links on compare page - Use the correct repo link for each commit(the headrepo). As for compare pages were baserepo != headrepo, it wouldn't have the correct link. Co-authored-by: zeripath <art27@cantab.net>
1 parent 8156e0f commit 9dcf0bf

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

templates/repo/commits_list.tmpl

+6-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
</tr>
1010
</thead>
1111
<tbody class="commit-list">
12+
{{$commitRepoLink := $.RepoLink}}{{if $.CommitRepoLink}}{{$commitRepoLink = $.CommitRepoLink}}{{end}}
1213
{{range .Commits}}
1314
<tr>
1415
<td class="author">
@@ -41,9 +42,9 @@
4142
{{end}}
4243
{{end}}
4344
{{if $.PageIsWiki}}
44-
<a href="{{$.RepoLink}}/wiki/commit/{{.ID}}" rel="nofollow" class="{{$class}}">
45+
<a href="{{$commitRepoLink}}/wiki/commit/{{.ID}}" rel="nofollow" class="{{$class}}">
4546
{{else if $.Reponame}}
46-
<a href="{{$.RepoLink}}/commit/{{.ID}}" rel="nofollow" class="{{$class}}">
47+
<a href="{{$commitRepoLink}}/commit/{{.ID}}" rel="nofollow" class="{{$class}}">
4748
{{else}}
4849
<span class="{{$class}}">
4950
{{end}}
@@ -62,16 +63,16 @@
6263
{{if $.PageIsWiki}}
6364
<span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{.Summary | RenderEmoji}}</span>
6465
{{else }}
65-
{{ $commitLink:= printf "%s/commit/%s" $.RepoLink (PathEscape .ID.String) }}
66-
<span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{RenderCommitMessageLinkSubject .Message $.RepoLink $commitLink $.Repository.ComposeMetas}}</span>
66+
{{ $commitLink:= printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String) }}
67+
<span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{RenderCommitMessageLinkSubject .Message $commitRepoLink $commitLink $.Repository.ComposeMetas}}</span>
6768
{{end}}
6869
</span>
6970
{{if IsMultilineCommitMessage .Message}}
7071
<button class="ui button ellipsis-button" aria-expanded="false">...</button>
7172
{{end}}
7273
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $}}
7374
{{if IsMultilineCommitMessage .Message}}
74-
<pre class="commit-body" style="display: none;">{{RenderCommitBody .Message $.RepoLink $.Repository.ComposeMetas}}</pre>
75+
<pre class="commit-body" style="display: none;">{{RenderCommitBody .Message $commitRepoLink $.Repository.ComposeMetas}}</pre>
7576
{{end}}
7677
</td>
7778
<td class="text right aligned">{{TimeSince .Author.When $.Lang}}</td>

0 commit comments

Comments
 (0)