Improve MR building

* fix 500 error when no parent for initial commit
* fix link from diff files to wrong commit

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Merge branch 'fix-mr-500-error' into 'master'

Fix MergeRequest#new page

* fix 500 error when no parent for initial commit
* fix link from diff files to wrong commit
* fix new file being skipped from diff if it was added in next commit

Fixes #1462

See merge request !998