gitlabhq/grit_ext — pull request #2 by cabello (2013-02-28 19:47:03+00:00)
Title: Avoid calling lines on nil diff

We use gitlab and we were facing some 500 errors while visiting diffs tab in merge requests.

Explanation:

Some empty files sometimes are committed when someone touch, chmod, chown them; their diff attribute in Grit::Diff is nil, but grit_ext overwrites diff attribute accessor and call lines on nil and BOOM exception.

This commit potentially closes:
- https://github.com/gitlabhq/gitlabhq/issues/2488
- https://github.com/gitlabhq/gitlabhq/issues/2916
- https://github.com/gitlabhq/gitlabhq/issues/3110

I am not a ruby developer and I know this is not the best solution for the problem, feel free to use any other approach to fix this issue.