diff options
author | mrsdizzie <info@mrsdizzie.com> | 2020-06-12 14:02:14 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-12 14:02:14 -0400 |
commit | d729d685d0703292a2f31eacf914f06036e3f108 (patch) | |
tree | 843239504b2b9e90261bd3c5bad966af2847368d /modules | |
parent | bc4f7ba69b01c6f10f6ea26325bf61485adaa0ff (diff) | |
download | gitea-d729d685d0703292a2f31eacf914f06036e3f108.tar.gz gitea-d729d685d0703292a2f31eacf914f06036e3f108.zip |
Fix 500 error on repos with no tags (#11870)
#11846 Introduced feature to show exact tag on commit view. However if a repo has no tags at all git prints out a separate and unhandled error " No names found, cannot describe anything."
Adding --always to the command makes it always use the error in the style of "fatal: no tag exactly matches" even if there are no tags at all.
Fixes #11869
Fixes #11868
Diffstat (limited to 'modules')
-rw-r--r-- | modules/git/commit.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/git/commit.go b/modules/git/commit.go index d6448bf26e..c06eabfbd4 100644 --- a/modules/git/commit.go +++ b/modules/git/commit.go @@ -484,7 +484,7 @@ func (c *Commit) GetBranchName() (string, error) { // GetTagName gets the current tag name for given commit func (c *Commit) GetTagName() (string, error) { - data, err := NewCommand("describe", "--exact-match", "--tags", c.ID.String()).RunInDir(c.repo.Path) + data, err := NewCommand("describe", "--exact-match", "--tags", "--always", c.ID.String()).RunInDir(c.repo.Path) if err != nil { // handle special case where there is no tag for this commit if strings.Contains(err.Error(), "no tag exactly matches") { |