github patches need to have the entire SHA1 hash

Review Request #1753 — Created Aug. 31, 2010 and discarded


Review Board


When uploading patches to review in review board and the project is hosted on github this happens:

* because git diff writes only a small part of the SHA1 by default this is recorded in the diff
* review board takes that part and tries to access the github API using only this info
* github offers an empty page with no HTTP error
* review board tries to apply a diff to an empty file, resulting in an error

Manual solution:
do a git diff with --full-index

Patch solution: if the diff doesn't contain the full index then throw an error
Tested at my organisation
  2. reviewboard/reviews/ (Diff revision 1)
    This class needs to remain SCMTool-agnostic. Other SCMTools (for example, ones created by third parties) may need to perform their own pre-fetch validation.
    I'd suggest instead placing this logic in GitTool.get_file.
  1. Ended up going a different route on this fix that will allow us to solve this in a more general way. Thanks though!