Skip to content

Commit 7e30986

Browse files
authored
Remove ref name in PR commits page (#25876)
The branch name display here is based on the repo's default branch which is not correct. ![image](https://github.com/go-gitea/gitea/assets/18380374/d899f6dc-b240-41ea-9a3e-ea0e103874ad) For example, if I changed the default branch, the branch name here will also be changed: ![image](https://github.com/go-gitea/gitea/assets/18380374/032ead94-2287-4158-a9e4-02e9fb74777d) ![image](https://github.com/go-gitea/gitea/assets/18380374/e1e6cbbc-31f8-40a2-b99a-508b5b2b3145) you can confirm this in : https://try.gitea.io/yp05327/testrepo/pulls/1/commits I think we do not need to display branch name here, as we already have the branch info above. ![image](https://github.com/go-gitea/gitea/assets/18380374/66f30a0c-3c2b-4d26-936d-bbe289f33be0)
1 parent 5104c88 commit 7e30986

File tree

2 files changed

+4
-7
lines changed

2 files changed

+4
-7
lines changed

routers/web/repo/commit.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,6 @@ func Commits(ctx *context.Context) {
8181
ctx.Data["Username"] = ctx.Repo.Owner.Name
8282
ctx.Data["Reponame"] = ctx.Repo.Repository.Name
8383
ctx.Data["CommitCount"] = commitsCount
84-
ctx.Data["RefName"] = ctx.Repo.RefName
8584

8685
pager := context.NewPagination(int(commitsCount), pageSize, page, 5)
8786
pager.SetDefaultParams(ctx)
@@ -157,7 +156,7 @@ func Graph(ctx *context.Context) {
157156
ctx.Data["Username"] = ctx.Repo.Owner.Name
158157
ctx.Data["Reponame"] = ctx.Repo.Repository.Name
159158
ctx.Data["CommitCount"] = commitsCount
160-
ctx.Data["RefName"] = ctx.Repo.RefName
159+
161160
paginator := context.NewPagination(int(graphCommitsCount), setting.UI.GraphMaxCommitNum, page, 5)
162161
paginator.AddParam(ctx, "mode", "Mode")
163162
paginator.AddParam(ctx, "hide-pr-refs", "HidePRRefs")
@@ -203,7 +202,6 @@ func SearchCommits(ctx *context.Context) {
203202
}
204203
ctx.Data["Username"] = ctx.Repo.Owner.Name
205204
ctx.Data["Reponame"] = ctx.Repo.Repository.Name
206-
ctx.Data["RefName"] = ctx.Repo.RefName
207205
ctx.HTML(http.StatusOK, tplCommits)
208206
}
209207

@@ -247,7 +245,6 @@ func FileHistory(ctx *context.Context) {
247245
ctx.Data["Reponame"] = ctx.Repo.Repository.Name
248246
ctx.Data["FileName"] = fileName
249247
ctx.Data["CommitCount"] = commitsCount
250-
ctx.Data["RefName"] = ctx.Repo.RefName
251248

252249
pager := context.NewPagination(int(commitsCount), setting.Git.CommitsRangeSize, page, 5)
253250
pager.SetDefaultParams(ctx)

templates/repo/commits_table.tmpl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<h4 class="ui top attached header commits-table gt-df gt-ac gt-sb">
22
<div class="commits-table-left gt-df gt-ac">
33
{{if or .PageIsCommits (gt .CommitCount 0)}}
4-
{{.CommitCount}} {{.locale.Tr "repo.commits.commits"}} {{if .RefName}}({{.RefName}}){{end}}
4+
{{.CommitCount}} {{.locale.Tr "repo.commits.commits"}}
55
{{else if .IsNothingToCompare}}
6-
{{.locale.Tr "repo.commits.nothing_to_compare"}} {{if .RefName}}({{.RefName}}){{end}}
6+
{{.locale.Tr "repo.commits.nothing_to_compare"}}
77
{{else}}
8-
{{.locale.Tr "repo.commits.no_commits" $.BaseBranch $.HeadBranch}} {{if .RefName}}({{.RefName}}){{end}}
8+
{{.locale.Tr "repo.commits.no_commits" $.BaseBranch $.HeadBranch}}
99
{{end}}
1010
</div>
1111
<div class="commits-table-right gt-whitespace-nowrap">

0 commit comments

Comments
 (0)