summaryrefslogtreecommitdiff
path: root/lib/gitlab/diff/diff_refs.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/gitlab/diff/diff_refs.rb')
-rw-r--r--lib/gitlab/diff/diff_refs.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/gitlab/diff/diff_refs.rb b/lib/gitlab/diff/diff_refs.rb
index 7948782aecc..371cbe04b9b 100644
--- a/lib/gitlab/diff/diff_refs.rb
+++ b/lib/gitlab/diff/diff_refs.rb
@@ -37,6 +37,16 @@ module Gitlab
def complete?
start_sha && head_sha
end
+
+ def compare_in(project)
+ # We're at the initial commit, so just get that as we can't compare to anything.
+ if Gitlab::Git.blank_ref?(start_sha)
+ project.commit(head_sha)
+ else
+ straight = start_sha == base_sha
+ CompareService.new(project, head_sha).execute(project, start_sha, straight: straight)
+ end
+ end
end
end
end