diff options
author | Robert Speicher <robert@gitlab.com> | 2015-11-17 21:51:40 +0300 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2015-11-17 21:52:09 +0300 |
commit | ea5a10b065e6f2d02b627790832424729ed578ce (patch) | |
tree | 3d3429352f0fe9db2b0d63438a6b30639de14882 /app | |
parent | 17a0cd46ccdad003b3bf36061fb16caa24a977a1 (diff) |
Merge branch 'compare-first-commit' into 'master'
Correctly set comparison first commit when range includes a merge commit
Fixes #3207.
See merge request !1814
Diffstat (limited to 'app')
-rw-r--r-- | app/controllers/projects/compare_controller.rb | 4 | ||||
-rw-r--r-- | app/helpers/diff_helper.rb | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/app/controllers/projects/compare_controller.rb b/app/controllers/projects/compare_controller.rb index 55134e11d15..5200d609cc9 100644 --- a/app/controllers/projects/compare_controller.rb +++ b/app/controllers/projects/compare_controller.rb @@ -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 diff --git a/app/helpers/diff_helper.rb b/app/helpers/diff_helper.rb index f47d5c4c742..0fd5c986588 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -175,7 +175,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 |