diff options
| author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-10-17 11:24:51 +0200 |
|---|---|---|
| committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-10-17 11:24:51 +0200 |
| commit | 40528a1326208a04f95f18d6dcc7547cdb8ae0c3 (patch) | |
| tree | 9e3f7ac86edfe03b218e3cd12ed9cae8b2b539f2 /app/models/compare.rb | |
| parent | 0e1f39d8cee3a6d23fccb195f8257178df840805 (diff) | |
| parent | 052de0600c6b137e6f9df08250b4cf5f38280295 (diff) | |
| download | gitlab-ce-40528a1326208a04f95f18d6dcc7547cdb8ae0c3.tar.gz | |
Merge remote-tracking branch 'origin/master' into 22191-delete-dynamic-envs-mr
Diffstat (limited to 'app/models/compare.rb')
| -rw-r--r-- | app/models/compare.rb | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/app/models/compare.rb b/app/models/compare.rb index 4856510f526..3a8bbcb1acd 100644 --- a/app/models/compare.rb +++ b/app/models/compare.rb @@ -11,9 +11,10 @@ class Compare end end - def initialize(compare, project) + def initialize(compare, project, straight: false) @compare = compare @project = project + @straight = straight end def commits @@ -45,6 +46,18 @@ class Compare end end + def start_commit_sha + start_commit.try(:sha) + end + + def base_commit_sha + base_commit.try(:sha) + end + + def head_commit_sha + commit.try(:sha) + end + def raw_diffs(*args) @compare.diffs(*args) end @@ -58,9 +71,9 @@ class Compare def diff_refs Gitlab::Diff::DiffRefs.new( - base_sha: base_commit.try(:sha), - start_sha: start_commit.try(:sha), - head_sha: commit.try(:sha) + base_sha: @straight ? start_commit_sha : base_commit_sha, + start_sha: start_commit_sha, + head_sha: head_commit_sha ) end end |
