Skip to content

Commit

Permalink
Only log non ErrNotExist errors in git.GetNote (go-gitea#19884)
Browse files Browse the repository at this point in the history
* Fix GetNote

* Only log errors if the error is not ErrNotExist

Signed-off-by: Andrew Thornton <art27@cantab.net>

Co-authored-by: Andrew Thornton <art27@cantab.net>
  • Loading branch information
2 people authored and AbdulrhmnGhanem committed Aug 23, 2022
1 parent 0f7fc86 commit 0a023d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion modules/git/notes_nogogit.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,10 @@ func GetNote(ctx context.Context, repo *Repository, commitID string, note *Note)
commitID = commitID[2:]
}
if err != nil {
log.Error("Unable to find git note corresponding to the commit %q. Error: %v", originalCommitID, err)
// Err may have been updated by the SubTree we need to recheck if it's again an ErrNotExist
if !IsErrNotExist(err) {
log.Error("Unable to find git note corresponding to the commit %q. Error: %v", originalCommitID, err)
}
return err
}
}
Expand Down

0 comments on commit 0a023d7

Please sign in to comment.