diff options
author | Robert Speicher <robert@gitlab.com> | 2015-11-17 18:51:40 +0000 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2015-11-17 18:51:40 +0000 |
commit | df6bb57921090ba9a9cfeb62cb012a503106389b (patch) | |
tree | ceefea7da2051ee638dea89c3db9462768181a7b /app | |
parent | 632f60cc76c1b2cd91a079ca8538d59fa28c9818 (diff) | |
parent | 24cf6865d3c0d47615a814c091cdb40bf513307e (diff) | |
download | gitlab-ce-df6bb57921090ba9a9cfeb62cb012a503106389b.tar.gz |
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 b715ecd85d2..bfd3622a6a9 100644 --- a/app/helpers/diff_helper.rb +++ b/app/helpers/diff_helper.rb @@ -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 |