Skip to content

Commit

Permalink
Don't consider tag refs as valid for branch name (go-gitea#11847)
Browse files Browse the repository at this point in the history
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
  • Loading branch information
2 people authored and Yohann Delafollye committed Jul 31, 2020
1 parent 9fcc8f2 commit 32253f8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/git/commit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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") {
Expand Down

0 comments on commit 32253f8

Please sign in to comment.