Only log non ErrNotExist errors in git.GetNote (#19884) (#19905)

* 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>

Co-authored-by: Andrew Thornton <art27@cantab.net>
pull/20001/head
Lunny Xiao 2 years ago committed by GitHub
parent 0e7791174d
commit ae91913132
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      modules/git/notes_nogogit.go

@ -47,7 +47,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
}
}

Loading…
Cancel
Save