Optimize diff creation from Rugged::Patch
Our diff threshold for pruning is fairly small, but we used to iterate over each line, even of a 100mb patch, just to check these small thresholds. Now we stop when any of the limits is met.
This should fix the issue reported in https://gitlab.com/gitlab-org/gitlab-ce/issues/2529