google / git-appraise

Distributed code review system for Git repos
Apache License 2.0
5.12k stars 145 forks source link

Validate review hashes when loading a review. #74

Closed ojarjur closed 6 years ago

ojarjur commented 7 years ago

This change improves the loading of reviews in two ways:

  1. Do not return a nil error from getSummaryFromNotes if the returned summary is nil, as that breaks assumptions made by callers that one of the two return values must be non-nil.
  2. Proactively check that the specified hash exists and points to a commit object before trying to load a review attached to that commit.

The combination of these two changes fixes #73

The first change prevents the tool from panicing on a bad input, while the second change makes the error message presented to the user easier to understand and fix.