From 4a4977a1f0232bcef474495b8e2e2b4e3ce12c49 Mon Sep 17 00:00:00 2001 From: Cirno the Strongest <1447794+CirnoT@users.noreply.github.com> Date: Thu, 11 Jun 2020 01:00:39 +0200 Subject: Don't consider tag refs as valid for branch name (#11847) Co-authored-by: techknowlogick --- modules/git/commit.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/git/commit.go b/modules/git/commit.go index 61428d23a4..a114c902dd 100644 --- a/modules/git/commit.go +++ b/modules/git/commit.go @@ -468,7 +468,7 @@ func (c *Commit) GetSubModule(entryname string) (*SubModule, error) { // GetBranchName gets the closes branch name (as returned by 'git name-rev --name-only') func (c *Commit) GetBranchName() (string, error) { - data, err := NewCommand("name-rev", "--name-only", "--no-undefined", c.ID.String()).RunInDir(c.repo.Path) + data, err := NewCommand("name-rev", "--exclude", "refs/tags/*", "--name-only", "--no-undefined", c.ID.String()).RunInDir(c.repo.Path) if err != nil { // handle special case where git can not describe commit if strings.Contains(err.Error(), "cannot describe") { -- cgit v1.2.3