mirror of
https://github.com/go-gitea/gitea
synced 2024-11-25 04:22:46 +01:00
Don't consider tag refs as valid for branch name (#11847)
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
parent
a05a30c1c1
commit
4a4977a1f0
1 changed files with 1 additions and 1 deletions
|
@ -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')
|
// GetBranchName gets the closes branch name (as returned by 'git name-rev --name-only')
|
||||||
func (c *Commit) GetBranchName() (string, error) {
|
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 {
|
if err != nil {
|
||||||
// handle special case where git can not describe commit
|
// handle special case where git can not describe commit
|
||||||
if strings.Contains(err.Error(), "cannot describe") {
|
if strings.Contains(err.Error(), "cannot describe") {
|
||||||
|
|
Loading…
Reference in a new issue