Skip to content

Commit 9419dd2

Browse files
authored
Stop logging an error when notes are not found (#18626)
This is an unnecessary logging event. Fix #18616 Signed-off-by: Andrew Thornton <[email protected]>
1 parent 3b33507 commit 9419dd2

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

modules/git/notes_gogit.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ func GetNote(ctx context.Context, repo *Repository, commitID string, note *Note)
2222
log.Trace("Searching for git note corresponding to the commit %q in the repository %q", commitID, repo.Path)
2323
notes, err := repo.GetCommit(NotesRef)
2424
if err != nil {
25+
if IsErrNotExist(err) {
26+
return err
27+
}
2528
log.Error("Unable to get commit from ref %q. Error: %v", NotesRef, err)
2629
return err
2730
}

modules/git/notes_nogogit.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ func GetNote(ctx context.Context, repo *Repository, commitID string, note *Note)
2121
log.Trace("Searching for git note corresponding to the commit %q in the repository %q", commitID, repo.Path)
2222
notes, err := repo.GetCommit(NotesRef)
2323
if err != nil {
24+
if IsErrNotExist(err) {
25+
return err
26+
}
2427
log.Error("Unable to get commit from ref %q. Error: %v", NotesRef, err)
2528
return err
2629
}

0 commit comments

Comments
 (0)