]> source.dussan.org Git - gitea.git/commitdiff
Stop logging an error when notes are not found (#18626)
authorzeripath <art27@cantab.net>
Sun, 6 Feb 2022 07:11:35 +0000 (07:11 +0000)
committerGitHub <noreply@github.com>
Sun, 6 Feb 2022 07:11:35 +0000 (15:11 +0800)
This is an unnecessary logging event.

Fix #18616

Signed-off-by: Andrew Thornton <art27@cantab.net>
modules/git/notes_gogit.go
modules/git/notes_nogogit.go

index 6cb719ce92a587e8664c687cef4e2de11755ea95..b1e5e453e4fba54d30331df5658d17782ca40c32 100644 (file)
@@ -22,6 +22,9 @@ func GetNote(ctx context.Context, repo *Repository, commitID string, note *Note)
        log.Trace("Searching for git note corresponding to the commit %q in the repository %q", commitID, repo.Path)
        notes, err := repo.GetCommit(NotesRef)
        if err != nil {
+               if IsErrNotExist(err) {
+                       return err
+               }
                log.Error("Unable to get commit from ref %q. Error: %v", NotesRef, err)
                return err
        }
index 13b4b7b36ab02cc84b3024d6421c65206b5b8414..bbc8ee1371da51fdfeb4dd00b33e4c7bdbe31f13 100644 (file)
@@ -21,6 +21,9 @@ func GetNote(ctx context.Context, repo *Repository, commitID string, note *Note)
        log.Trace("Searching for git note corresponding to the commit %q in the repository %q", commitID, repo.Path)
        notes, err := repo.GetCommit(NotesRef)
        if err != nil {
+               if IsErrNotExist(err) {
+                       return err
+               }
                log.Error("Unable to get commit from ref %q. Error: %v", NotesRef, err)
                return err
        }