Skip to content

Commit 4a4977a

Browse files
Don't consider tag refs as valid for branch name (#11847)
Co-authored-by: techknowlogick <[email protected]>
1 parent a05a30c commit 4a4977a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

modules/git/commit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ func (c *Commit) GetSubModule(entryname string) (*SubModule, error) {
468468

469469
// GetBranchName gets the closes branch name (as returned by 'git name-rev --name-only')
470470
func (c *Commit) GetBranchName() (string, error) {
471-
data, err := NewCommand("name-rev", "--name-only", "--no-undefined", c.ID.String()).RunInDir(c.repo.Path)
471+
data, err := NewCommand("name-rev", "--exclude", "refs/tags/*", "--name-only", "--no-undefined", c.ID.String()).RunInDir(c.repo.Path)
472472
if err != nil {
473473
// handle special case where git can not describe commit
474474
if strings.Contains(err.Error(), "cannot describe") {

0 commit comments

Comments
 (0)