Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show correct text when comparing commits on empty pull request #16569

Merged
merged 4 commits into from
Jul 29, 2021
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions options/locale/locale_en-US.ini
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,7 @@ editor.require_signed_commit = Branch requires a signed commit
commits.desc = Browse source code change history.
commits.commits = Commits
commits.no_commits = No commits in common. '%s' and '%s' have entirely different histories.
commits.nothing_to_compare = These branches are equal.
commits.search = Search commits…
commits.search.tooltip = You can prefix keywords with "author:", "committer:", "after:", or "before:", e.g. "revert author:Alice before:2019-04-01".
commits.find = Search
Expand Down
4 changes: 4 additions & 0 deletions routers/web/repo/pull.go
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,10 @@ func PrepareViewPullInfo(ctx *context.Context, issue *models.Issue) *git.Compare
return nil
}

if compareInfo.HeadCommitID == compareInfo.MergeBase {
ctx.Data["IsNothingToCompare"] = true
}

ctx.Data["PullRequestWorkInProgressPrefixes"] = setting.Repository.PullRequest.WorkInProgressPrefixes

if pull.IsWorkInProgress() {
Expand Down
3 changes: 3 additions & 0 deletions templates/repo/commits_table.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
<div class="commits-table-left df ac">
{{if or .PageIsCommits (gt .CommitCount 0)}}
{{.CommitCount}} {{.i18n.Tr "repo.commits.commits"}} {{if .Branch}}({{.Branch}}){{end}}
{{else if .IsNothingToCompare }}
{{.i18n.Tr "repo.commits.nothing_to_compare" }} {{if .Branch}}({{.Branch}}){{end}}

{{else}}
{{.i18n.Tr "repo.commits.no_commits" $.BaseBranch $.HeadBranch }} {{if .Branch}}({{.Branch}}){{end}}
{{end}}
Expand Down