If a review request was uploaded with a FileDiff
that contained a
parent diff that creates a 0 byte file, we would previously be unable to
generate the pre-patch file due to a limitation of patch(1)
. To work
around this, when we encounter a specific error from patch (that is,
when it only finds what it considers garbage in the input), we check to
see if the parent diff is empty and if so we return an empty buffer.
Future calls will get_original_file
for that file will have no extra
database query overhead as the results of this (which costs at least two
queries) will be cached with the FileDiff
.