From 8f80f3ec7df8f44e205cba4b3e6efc20aab4010c Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Sat, 5 Oct 2019 22:53:09 +0200 Subject: [PATCH 1/3] manual merge tag ... if: * no commits ahead default branch * not same as default branch --- options/locale/locale_en-US.ini | 1 + routers/repo/branch.go | 7 +++++++ templates/repo/branch/list.tmpl | 6 +++++- 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index c8be059b72027..52d7a2d7fb272 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -1448,6 +1448,7 @@ branch.restore_failed = Failed to restore branch '%s'. branch.protected_deletion_failed = Branch '%s' is protected. It cannot be deleted. branch.restore = Restore Branch '%s' branch.download = Download Branch '%s' +branch.manual_merged = Branch was merged manually topic.manage_topics = Manage Topics topic.done = Done diff --git a/routers/repo/branch.go b/routers/repo/branch.go index 5d78518491dfa..0019f6542a366 100644 --- a/routers/repo/branch.go +++ b/routers/repo/branch.go @@ -28,6 +28,7 @@ type Branch struct { Commit *git.Commit IsProtected bool IsDeleted bool + IsMerged bool DeletedBranch *models.DeletedBranch CommitsAhead int CommitsBehind int @@ -203,10 +204,16 @@ func loadBranches(ctx *context.Context) []*Branch { } } + isMerged := true + if (divergence.Ahead != 0) || (divergence.Behind == 0) || (ctx.Repo.Repository.DefaultBranch == branchName) { + isMerged = false + } + branches[i] = &Branch{ Name: branchName, Commit: commit, IsProtected: isProtected, + IsMerged: isMerged, CommitsAhead: divergence.Ahead, CommitsBehind: divergence.Behind, LatestPullRequest: pr, diff --git a/templates/repo/branch/list.tmpl b/templates/repo/branch/list.tmpl index 9c53f4e67a36d..35b06c726323e 100644 --- a/templates/repo/branch/list.tmpl +++ b/templates/repo/branch/list.tmpl @@ -75,7 +75,11 @@