Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Chao <mchao@gitlab.com>2018-10-25 16:46:04 +0300
committerMark Chao <mchao@gitlab.com>2018-11-07 06:28:43 +0300
commit67b579c54e77a28db2736401e698f609a713d0f3 (patch)
treea49473d2b1514cad519087a5636a38483e7c4ccd /app/models/compare.rb
parente48ce6322e99ac12ec7c310ef59564a125082202 (diff)
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