summaryrefslogtreecommitdiff
path: root/app/views/projects/commits
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-28 20:54:40 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-28 20:54:40 +0300
commitddaa493ef3f6ca2b84bc02acc7a5961cf18e3c12 (patch)
tree84ae5a547675086fe8ab1cd354603bcbe879bd3c /app/views/projects/commits
parent00c6723883671769f6efd692f935dc3203d7ccc6 (diff)
downloadgitlab-ce-ddaa493ef3f6ca2b84bc02acc7a5961cf18e3c12.tar.gz
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>
Diffstat (limited to 'app/views/projects/commits')
-rw-r--r--app/views/projects/commits/_diff_file.html.haml5
1 files changed, 2 insertions, 3 deletions
diff --git a/app/views/projects/commits/_diff_file.html.haml b/app/views/projects/commits/_diff_file.html.haml
index 45d1cd9c9a0..9cbcb84aead 100644
--- a/app/views/projects/commits/_diff_file.html.haml
+++ b/app/views/projects/commits/_diff_file.html.haml
@@ -1,5 +1,4 @@
-- file = project.repository.blob_at(@commit.id, diff.new_path)
-- file = project.repository.blob_at(@commit.parent_id, diff.old_path) unless file
+- file = project.repository.blob_for_diff(@commit, diff)
- return unless file
.diff-file{id: "diff-#{i}"}
.diff-header{id: "file-path-#{hexdigest(diff.new_path || diff.old_path)}"}
@@ -41,7 +40,7 @@
- else
= render "projects/commits/text_file", diff: diff, index: i
- elsif file.image?
- - old_file = project.repository.blob_at(@commit.parent_id, diff.old_path) if @commit.parent_id
+ - old_file = project.repository.prev_blob_for_diff(@commit, diff)
= render "projects/commits/image", diff: diff, old_file: old_file, file: file, index: i
- else
.nothing-here-block No preview for this file type