summaryrefslogtreecommitdiff
path: root/app/models/compare.rb
diff options
context:
space:
mode:
authorMark Chao <mchao@gitlab.com>2018-10-25 21:46:04 +0800
committerMark Chao <mchao@gitlab.com>2018-11-07 11:28:43 +0800
commit67b579c54e77a28db2736401e698f609a713d0f3 (patch)
treea49473d2b1514cad519087a5636a38483e7c4ccd /app/models/compare.rb
parente48ce6322e99ac12ec7c310ef59564a125082202 (diff)
downloadgitlab-ce-67b579c54e77a28db2736401e698f609a713d0f3.tar.gz
Allow getting all paths (old & new) involved in MR
Fetch database columns directly if available
Diffstat (limited to 'app/models/compare.rb')
-rw-r--r--app/models/compare.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/compare.rb b/app/models/compare.rb
index b2d46ada831..f1ed84ab5a5 100644
--- a/app/models/compare.rb
+++ b/app/models/compare.rb
@@ -1,5 +1,7 @@
# frozen_string_literal: true
+require 'set'
+
class Compare
include Gitlab::Utils::StrongMemoize
@@ -77,4 +79,13 @@ class Compare
head_sha: head_commit_sha
)
end
+
+ def modified_paths
+ paths = Set.new
+ diffs.diff_files.each do |diff|
+ paths.add diff.old_path
+ paths.add diff.new_path
+ end
+ paths.to_a
+ end
end