]> source.dussan.org Git - gitea.git/commitdiff
Correctly handle draft releases without a tag (#20314)
authorChongyi Zheng <harry@harryzheng.com>
Tue, 12 Jul 2022 12:57:38 +0000 (08:57 -0400)
committerGitHub <noreply@github.com>
Tue, 12 Jul 2022 12:57:38 +0000 (13:57 +0100)
Fixes #20313.

`errors.Is(err, git.ErrNotExist{})` is not working

services/migrations/gitea_uploader.go

index e71b2ca17af35afaf46f195192af1c641b7dc0c4..c7a6f9b02f2c3e8ecbf25718b7b30017cde958d2 100644 (file)
@@ -7,7 +7,6 @@ package migrations
 
 import (
        "context"
-       "errors"
        "fmt"
        "io"
        "os"
@@ -268,7 +267,7 @@ func (g *GiteaLocalUploader) CreateReleases(releases ...*base.Release) error {
                // calc NumCommits if possible
                if rel.TagName != "" {
                        commit, err := g.gitRepo.GetTagCommit(rel.TagName)
-                       if !errors.Is(err, git.ErrNotExist{}) {
+                       if !git.IsErrNotExist(err) {
                                if err != nil {
                                        return fmt.Errorf("GetTagCommit[%v]: %v", rel.TagName, err)
                                }