Commit 5cad2d29 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Add improvements to merge request versions

* show commits count in the merge request version dropdown
* initialize base/start commit sha for old merge request diffs from repo
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 964742f6
...@@ -34,7 +34,9 @@ class MergeRequestDiff < ActiveRecord::Base ...@@ -34,7 +34,9 @@ class MergeRequestDiff < ActiveRecord::Base
if persisted? if persisted?
# Workaround for old MergeRequestDiff object # Workaround for old MergeRequestDiff object
# that does not have head_commit_sha in the database # that does not have head_commit_sha in the database
self.head_commit_sha ||= last_commit.sha self.start_commit_sha ||= merge_request.target_branch_sha
self.head_commit_sha ||= last_commit.sha
self.base_commit_sha ||= find_base_sha
else else
self.start_commit_sha ||= merge_request.target_branch_sha self.start_commit_sha ||= merge_request.target_branch_sha
self.head_commit_sha ||= merge_request.source_branch_sha self.head_commit_sha ||= merge_request.source_branch_sha
......
...@@ -20,8 +20,9 @@ ...@@ -20,8 +20,9 @@
#{merge_request_diff.head_commit.short_id} #{merge_request_diff.head_commit.short_id}
%br %br
%small %small
#{number_with_delimiter(merge_request_diff.commits.count)} #{'commit'.pluralize(merge_request_diff.commits.count)},
= time_ago_with_tooltip(merge_request_diff.created_at) = time_ago_with_tooltip(merge_request_diff.created_at)
.pull-right .pull-right
%span.monospace %span.monospace
git diff #{@merge_request_diff.base_commit.short_id}..#{@merge_request_diff.head_commit.short_id} #{@merge_request_diff.base_commit.short_id}..#{@merge_request_diff.head_commit.short_id}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment