From b19d3b2066172e1f9025983a118f3c895b726dbb Mon Sep 17 00:00:00 2001 From: Aaron Meese Date: Wed, 25 Jun 2025 20:54:17 -0400 Subject: [PATCH 1/6] Adds title on branch commit counts --- templates/repo/branch/list.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index fffe3a08cc4bf..62d0fc6a82fdc 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -110,12 +110,12 @@ {{if and (not .DBBranch.IsDeleted) $.DefaultBranchBranch}}
-
{{.CommitsBehind}}
+
{{.CommitsBehind}}
{{/* old code bears 0/0.0 = NaN output, so it might output invalid "width: NaNpx", it just works and doesn't caues any problem. */}}
-
{{.CommitsAhead}}
+
{{.CommitsAhead}}
From f1e7fff7c4cf34d1f6d2f6ff214a2418a701fd1d Mon Sep 17 00:00:00 2001 From: Aaron Meese Date: Sun, 29 Jun 2025 15:39:43 -0400 Subject: [PATCH 2/6] fix: transition to `data-tooltip-content` --- templates/repo/branch/list.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 62d0fc6a82fdc..68381d0eff112 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -110,12 +110,12 @@ {{if and (not .DBBranch.IsDeleted) $.DefaultBranchBranch}}
-
{{.CommitsBehind}}
+
{{.CommitsBehind}}
{{/* old code bears 0/0.0 = NaN output, so it might output invalid "width: NaNpx", it just works and doesn't caues any problem. */}}
-
{{.CommitsAhead}}
+
{{.CommitsAhead}}
From 556fcf73c574ed6bc3faf4c9e4d76c7ce2fd0324 Mon Sep 17 00:00:00 2001 From: Aaron Meese Date: Sun, 29 Jun 2025 18:39:11 -0400 Subject: [PATCH 3/6] fix: use translations --- options/locale/locale_en-US.ini | 4 ++++ templates/repo/branch/list.tmpl | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 0d82f9e92066e..9904a1f7f8beb 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2769,6 +2769,10 @@ branch.new_branch_from = Create new branch from "%s" branch.renamed = Branch %s was renamed to %s. branch.rename_default_or_protected_branch_error = Only admins can rename default or protected branches. branch.rename_protected_branch_failed = This branch is protected by glob-based protection rules. +branch.commits_ahead_1 = %d commit ahead of %s +branch.commits_ahead_n = %d commits ahead of %s +branch.commits_behind_1 = %d commit behind %s +branch.commits_behind_n = %d commits behind %s tag.create_tag = Create tag %s tag.create_tag_operation = Create tag diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 68381d0eff112..7cf2e9db934c7 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -110,12 +110,12 @@ {{if and (not .DBBranch.IsDeleted) $.DefaultBranchBranch}}
-
{{.CommitsBehind}}
+
{{.CommitsBehind}}
{{/* old code bears 0/0.0 = NaN output, so it might output invalid "width: NaNpx", it just works and doesn't caues any problem. */}}
-
{{.CommitsAhead}}
+
{{.CommitsAhead}}
From 465f42e267088665714be9c5504f4b0d573d1822 Mon Sep 17 00:00:00 2001 From: Aaron Meese Date: Mon, 30 Jun 2025 11:14:55 -0400 Subject: [PATCH 4/6] fix: requested changes --- options/locale/locale_en-US.ini | 4 ++-- templates/repo/branch/list.tmpl | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 9904a1f7f8beb..4dea2475828a5 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2769,8 +2769,8 @@ branch.new_branch_from = Create new branch from "%s" branch.renamed = Branch %s was renamed to %s. branch.rename_default_or_protected_branch_error = Only admins can rename default or protected branches. branch.rename_protected_branch_failed = This branch is protected by glob-based protection rules. -branch.commits_ahead_1 = %d commit ahead of %s -branch.commits_ahead_n = %d commits ahead of %s +branch.commits_ahead_1 = %d commit ahead +branch.commits_ahead_n = %d commits ahead branch.commits_behind_1 = %d commit behind %s branch.commits_behind_n = %d commits behind %s diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 7cf2e9db934c7..c819bbab95a25 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -108,14 +108,14 @@ {{if and (not .DBBranch.IsDeleted) $.DefaultBranchBranch}} -
+
-
{{.CommitsBehind}}
+
{{.CommitsBehind}}
{{/* old code bears 0/0.0 = NaN output, so it might output invalid "width: NaNpx", it just works and doesn't caues any problem. */}}
-
{{.CommitsAhead}}
+
{{.CommitsAhead}}
From a6a4a5033053a147d691f4fb90ba7ec685658d2d Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 1 Jul 2025 09:36:00 +0800 Subject: [PATCH 5/6] fine tune --- options/locale/locale_en-US.ini | 6 ++---- templates/repo/branch/list.tmpl | 12 +++++++++--- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 4dea2475828a5..47b6ae5de0230 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2769,10 +2769,8 @@ branch.new_branch_from = Create new branch from "%s" branch.renamed = Branch %s was renamed to %s. branch.rename_default_or_protected_branch_error = Only admins can rename default or protected branches. branch.rename_protected_branch_failed = This branch is protected by glob-based protection rules. -branch.commits_ahead_1 = %d commit ahead -branch.commits_ahead_n = %d commits ahead -branch.commits_behind_1 = %d commit behind %s -branch.commits_behind_n = %d commits behind %s +branch.commits_divergence_from = Commits divergence: %[1]d behind and %[2]d ahead %[3]s +branch.commits_no_divergence = The same as branch %[1]s tag.create_tag = Create tag %s tag.create_tag_operation = Create tag diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index c819bbab95a25..9e86641c6fecd 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -107,8 +107,14 @@ {{end}} - {{if and (not .DBBranch.IsDeleted) $.DefaultBranchBranch}} -
+ {{if and (not .DBBranch.IsDeleted) $.DefaultBranchBranch}} + {{$tooltipDivergence := ""}} + {{if or .CommitsBehind .CommitsAhead}} + {{$tooltipDivergence = ctx.Locale.Tr "repo.branch.commits_divergence_from" .CommitsBehind .CommitsAhead $.DefaultBranchBranch.DBBranch.Name}} + {{else}} + {{$tooltipDivergence = ctx.Locale.Tr "repo.branch.commits_no_divergence" $.DefaultBranchBranch.DBBranch.Name}} + {{end}} +
{{.CommitsBehind}}
{{/* old code bears 0/0.0 = NaN output, so it might output invalid "width: NaNpx", it just works and doesn't caues any problem. */}} @@ -119,7 +125,7 @@
- {{end}} + {{end}} {{if not .LatestPullRequest}} From d622da7b5eea8eaf1f845f96121632aadab65694 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 1 Jul 2025 10:05:31 +0800 Subject: [PATCH 6/6] use "ahead of" Signed-off-by: wxiaoguang --- options/locale/locale_en-US.ini | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index 47b6ae5de0230..9b20f204a1466 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2769,7 +2769,7 @@ branch.new_branch_from = Create new branch from "%s" branch.renamed = Branch %s was renamed to %s. branch.rename_default_or_protected_branch_error = Only admins can rename default or protected branches. branch.rename_protected_branch_failed = This branch is protected by glob-based protection rules. -branch.commits_divergence_from = Commits divergence: %[1]d behind and %[2]d ahead %[3]s +branch.commits_divergence_from = Commits divergence: %[1]d behind and %[2]d ahead of %[3]s branch.commits_no_divergence = The same as branch %[1]s tag.create_tag = Create tag %s