summaryrefslogtreecommitdiff
path: root/scripts/ee-specific-lines-check
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-09-18 14:02:45 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-09-18 14:02:45 +0000
commit80f61b4035607d7cd87de993b8f5e996bde3481f (patch)
tree06b12f51e97d87192e3dd0e05edf55143645b894 /scripts/ee-specific-lines-check
parent4ab54c2233e91f60a80e5b6fa2181e6899fdcc3e (diff)
downloadgitlab-ce-80f61b4035607d7cd87de993b8f5e996bde3481f.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'scripts/ee-specific-lines-check')
-rwxr-xr-xscripts/ee-specific-lines-check42
1 files changed, 42 insertions, 0 deletions
diff --git a/scripts/ee-specific-lines-check b/scripts/ee-specific-lines-check
new file mode 100755
index 00000000000..4114575168c
--- /dev/null
+++ b/scripts/ee-specific-lines-check
@@ -0,0 +1,42 @@
+#!/usr/bin/env ruby
+
+require_relative 'ee_specific_check/ee_specific_check'
+
+include EESpecificCheck # rubocop:disable Style/MixinUsage
+git_version
+
+base = find_compare_base
+
+current_numstat = updated_diff_numstat(base.ce_base, base.ee_base)
+updated_numstat = updated_diff_numstat(base.ce_head, base.ee_head)
+
+offenses = updated_numstat.select do |file, updated_delta|
+ current_delta = current_numstat[file]
+
+ more_lines = updated_delta > current_delta
+
+ more_lines &&
+ !WHITELIST.any? { |pattern| Dir.glob(pattern, File::FNM_DOTMATCH).include?(file) }
+end
+
+if offenses.empty?
+ say "🎉 All good, congrats! 🎉"
+else
+ puts
+
+ offenses.each do |(file, delta)|
+ puts "* 💥 #{file} has #{delta - current_numstat[file]} updated lines that differ between EE and CE! 💥"
+ end
+
+ say <<~MESSAGE
+ ℹ️ Make sure all lines in shared files have been updated in your backport merge request and the branch name includes #{minimal_ce_branch_name}.
+ ℹ️ Consider using an EE module to add the features you want.
+ ℹ️ See this for detail: https://docs.gitlab.com/ee/development/ee_features.html#ee-features-based-on-ce-features
+ MESSAGE
+end
+
+remove_remotes
+
+say "ℹ️ For more information on why, see https://gitlab.com/gitlab-org/gitlab/issues/2952"
+
+exit(offenses.size)