Skip to content

Commit f3f4458

Browse files
authored
Use print instead of printf (#27093)
A bit more performant when we only use it for appending strings.
1 parent 7cdbe65 commit f3f4458

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

templates/explore/repo_search.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
</div>
3737
{{if and .PageIsExploreRepositories .OnlyShowRelevant}}
3838
<div class="ui message explore-relevancy-note">
39-
<span data-tooltip-content="{{.locale.Tr "explore.relevant_repositories_tooltip"}}">{{.locale.Tr "explore.relevant_repositories" ((printf "%s%s" $.Link "?only_show_relevant=0")|Escape) | Safe}}</span>
39+
<span data-tooltip-content="{{.locale.Tr "explore.relevant_repositories_tooltip"}}">{{.locale.Tr "explore.relevant_repositories" ((print $.Link "?only_show_relevant=0")|Escape) | Safe}}</span>
4040
</div>
4141
{{end}}
4242
<div class="divider"></div>

templates/repo/commit_page.tmpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44
<div class="ui container fluid padded">
55
{{$class := ""}}
66
{{if .Commit.Signature}}
7-
{{$class = (printf "%s%s" $class " isSigned")}}
7+
{{$class = (print $class " isSigned")}}
88
{{if .Verification.Verified}}
99
{{if eq .Verification.TrustStatus "trusted"}}
10-
{{$class = (printf "%s%s" $class " isVerified")}}
10+
{{$class = (print $class " isVerified")}}
1111
{{else if eq .Verification.TrustStatus "untrusted"}}
12-
{{$class = (printf "%s%s" $class " isVerifiedUntrusted")}}
12+
{{$class = (print $class " isVerifiedUntrusted")}}
1313
{{else}}
14-
{{$class = (printf "%s%s" $class " isVerifiedUnmatched")}}
14+
{{$class = (print $class " isVerifiedUnmatched")}}
1515
{{end}}
1616
{{else if .Verification.Warning}}
17-
{{$class = (printf "%s%s" $class " isWarning")}}
17+
{{$class = (print $class " isWarning")}}
1818
{{end}}
1919
{{end}}
2020
<div class="ui top attached header clearing segment gt-relative commit-header {{$class}}">

templates/repo/commits_list.tmpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,17 @@
2828
<button class="ui button copy-commit-sha gt-df gt-ac" data-clipboard-text="{{.ID}}">{{svg "octicon-copy" 14}}</button>
2929
{{$class := "ui sha label"}}
3030
{{if .Signature}}
31-
{{$class = (printf "%s%s" $class " isSigned")}}
31+
{{$class = (print $class " isSigned")}}
3232
{{if .Verification.Verified}}
3333
{{if eq .Verification.TrustStatus "trusted"}}
34-
{{$class = (printf "%s%s" $class " isVerified")}}
34+
{{$class = (print $class " isVerified")}}
3535
{{else if eq .Verification.TrustStatus "untrusted"}}
36-
{{$class = (printf "%s%s" $class " isVerifiedUntrusted")}}
36+
{{$class = (print $class " isVerifiedUntrusted")}}
3737
{{else}}
38-
{{$class = (printf "%s%s" $class " isVerifiedUnmatched")}}
38+
{{$class = (print $class " isVerifiedUnmatched")}}
3939
{{end}}
4040
{{else if .Verification.Warning}}
41-
{{$class = (printf "%s%s" $class " isWarning")}}
41+
{{$class = (print $class " isWarning")}}
4242
{{end}}
4343
{{end}}
4444
{{$commitShaLink := ""}}

templates/repo/commits_list_small.tmpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@
1717
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $.root}}
1818
{{$class := "ui sha label"}}
1919
{{if .Signature}}
20-
{{$class = (printf "%s%s" $class " isSigned")}}
20+
{{$class = (print $class " isSigned")}}
2121
{{if .Verification.Verified}}
2222
{{if eq .Verification.TrustStatus "trusted"}}
23-
{{$class = (printf "%s%s" $class " isVerified")}}
23+
{{$class = (print $class " isVerified")}}
2424
{{else if eq .Verification.TrustStatus "untrusted"}}
25-
{{$class = (printf "%s%s" $class " isVerifiedUntrusted")}}
25+
{{$class = (print $class " isVerifiedUntrusted")}}
2626
{{else}}
27-
{{$class = (printf "%s%s" $class " isVerifiedUnmatched")}}
27+
{{$class = (print $class " isVerifiedUnmatched")}}
2828
{{end}}
2929
{{else if .Verification.Warning}}
30-
{{$class = (printf "%s%s" $class " isWarning")}}
30+
{{$class = (print $class " isWarning")}}
3131
{{end}}
3232
{{end}}
3333
<a href="{{$commitLink}}" rel="nofollow" class="gt-ml-3 {{$class}}">

templates/repo/create_helper.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{{if not $.DisableMigrations}}
2-
<p class="ui center">{{.locale.Tr "repo.new_repo_helper" ((printf "%s%s" AppSubUrl "/repo/migrate")|Escape) | Safe}}</p>
2+
<p class="ui center">{{.locale.Tr "repo.new_repo_helper" ((print AppSubUrl "/repo/migrate")|Escape) | Safe}}</p>
33
{{end}}

templates/repo/graph/commits.tmpl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@
88
<span class="sha" id="{{$commit.ShortRev}}">
99
{{$class := "ui sha label"}}
1010
{{if $commit.Commit.Signature}}
11-
{{$class = (printf "%s%s" $class " isSigned")}}
11+
{{$class = (print $class " isSigned")}}
1212
{{if $commit.Verification.Verified}}
1313
{{if eq $commit.Verification.TrustStatus "trusted"}}
14-
{{$class = (printf "%s%s" $class " isVerified")}}
14+
{{$class = (print $class " isVerified")}}
1515
{{else if eq $commit.Verification.TrustStatus "untrusted"}}
16-
{{$class = (printf "%s%s" $class " isVerifiedUntrusted")}}
16+
{{$class = (print $class " isVerifiedUntrusted")}}
1717
{{else}}
18-
{{$class = (printf "%s%s" $class " isVerifiedUnmatched")}}
18+
{{$class = (print $class " isVerifiedUnmatched")}}
1919
{{end}}
2020
{{else if $commit.Verification.Warning}}
21-
{{$class = (printf "%s%s" $class " isWarning")}}
21+
{{$class = (print $class " isWarning")}}
2222
{{end}}
2323
{{end}}
2424
<a href="{{$.RepoLink}}/commit/{{$commit.Rev|PathEscape}}" rel="nofollow" class="{{$class}}">

templates/repo/home.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
{{if ne .Repository.ID .BaseRepo.ID}}
7171
{{$cmpBranch = printf "%s/%s:" (.Repository.OwnerName|PathEscape) (.Repository.Name|PathEscape)}}
7272
{{end}}
73-
{{$cmpBranch = printf "%s%s" $cmpBranch (.BranchName|PathEscapeSegments)}}
73+
{{$cmpBranch = print $cmpBranch (.BranchName|PathEscapeSegments)}}
7474
{{$compareLink := printf "%s/compare/%s...%s" .BaseRepo.Link (.BaseRepo.DefaultBranch|PathEscapeSegments) $cmpBranch}}
7575
<a id="new-pull-request" role="button" class="ui compact basic button" href="{{$compareLink}}"
7676
data-tooltip-content="{{if .PullRequestCtx.Allowed}}{{.locale.Tr "repo.pulls.compare_changes"}}{{else}}{{.locale.Tr "action.compare_branch"}}{{end}}">

0 commit comments

Comments
 (0)