Merge branch 'compare-first-commit' into 'master'

Correctly set comparison first commit when range includes a merge commit

Fixes #3207.

See merge request !1814
This commit is contained in:
Robert Speicher 2015-11-17 18:51:40 +00:00
commit df6bb57921
2 changed files with 3 additions and 3 deletions

View file

@ -20,8 +20,8 @@ class Projects::CompareController < Projects::ApplicationController
if compare_result
@commits = Commit.decorate(compare_result.commits, @project)
@diffs = compare_result.diffs
@commit = @commits.last
@first_commit = @commits.first
@commit = @project.commit(head_ref)
@first_commit = @project.commit(base_ref)
@line_notes = []
end
end

View file

@ -161,7 +161,7 @@ module DiffHelper
def commit_for_diff(diff)
if diff.deleted_file
first_commit = @first_commit || @commit
first_commit.parent
first_commit.parent || @first_commit
else
@commit
end