From 22b2b4d5c69d5ff680603502e4e067f9c48da168 Mon Sep 17 00:00:00 2001 From: Andrew Thornton Date: Sat, 5 Feb 2022 18:58:52 +0000 Subject: [PATCH] Stop logging an error when notes are not found This is an unnecessary logging event. Fix #18616 Signed-off-by: Andrew Thornton --- modules/git/notes_gogit.go | 3 +++ modules/git/notes_nogogit.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/modules/git/notes_gogit.go b/modules/git/notes_gogit.go index 6cb719ce92a5..b1e5e453e4fb 100644 --- a/modules/git/notes_gogit.go +++ b/modules/git/notes_gogit.go @@ -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 } diff --git a/modules/git/notes_nogogit.go b/modules/git/notes_nogogit.go index 13b4b7b36ab0..bbc8ee1371da 100644 --- a/modules/git/notes_nogogit.go +++ b/modules/git/notes_nogogit.go @@ -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 }