summaryrefslogtreecommitdiff
path: root/lib/gitlab/diff/position.rb
diff options
context:
space:
mode:
authorDouwe Maan <douwe@selenight.nl>2017-06-06 11:46:28 -0500
committerDouwe Maan <douwe@selenight.nl>2017-06-06 14:48:05 -0500
commit3a5d375e49b808ca203cb40b5f907aafb40f53aa (patch)
treeb6083a59d35cfd4bef6a54df9aa7f95a82d6d193 /lib/gitlab/diff/position.rb
parent4ab1e07fd3fef373a83137ca851558b0f327bfd5 (diff)
downloadgitlab-ce-3a5d375e49b808ca203cb40b5f907aafb40f53aa.tar.gz
Fix Diff::Position#diff_file for positions on straight diffsdm-diff-file-straight-diff
Diffstat (limited to 'lib/gitlab/diff/position.rb')
-rw-r--r--lib/gitlab/diff/position.rb18
1 files changed, 2 insertions, 16 deletions
diff --git a/lib/gitlab/diff/position.rb b/lib/gitlab/diff/position.rb
index 4d96778a2b2..f80afb20f0c 100644
--- a/lib/gitlab/diff/position.rb
+++ b/lib/gitlab/diff/position.rb
@@ -145,23 +145,9 @@ module Gitlab
private
def find_diff_file(repository)
- # We're at the initial commit, so just get that as we can't compare to anything.
- compare =
- if Gitlab::Git.blank_ref?(start_sha)
- Gitlab::Git::Commit.find(repository.raw_repository, head_sha)
- else
- Gitlab::Git::Compare.new(
- repository.raw_repository,
- start_sha,
- head_sha
- )
- end
-
- diff = compare.diffs(paths: paths).first
-
- return unless diff
+ return unless diff_refs.complete?
- Gitlab::Diff::File.new(diff, repository: repository, diff_refs: diff_refs)
+ diff_refs.compare_in(repository.project).diffs(paths: paths, expanded: true).diff_files.first
end
end
end