diff options
author | Rémy Coutable <remy@rymai.me> | 2016-11-22 19:13:41 +0100 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2016-11-22 19:14:26 +0100 |
commit | 2d5fa49f056ffac1d49be25161c981e57211c8f3 (patch) | |
tree | 7bf2c547e4d6da0ee12ae1cea0e8c20cd9a1fc61 | |
parent | b8980e89aa87901ef17f4fed58802d07ddbb1b6a (diff) | |
download | gitlab-ce-fix-ee_compat_check-when-branch-contains-a-slash.tar.gz |
Ensure we sanitize branch names with path-unfriendly charactersfix-ee_compat_check-when-branch-contains-a-slash
Signed-off-by: Rémy Coutable <remy@rymai.me>
-rw-r--r-- | lib/gitlab/ee_compat_check.rb | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab/ee_compat_check.rb b/lib/gitlab/ee_compat_check.rb index f4d1505ea91..60e7771fbd1 100644 --- a/lib/gitlab/ee_compat_check.rb +++ b/lib/gitlab/ee_compat_check.rb @@ -149,7 +149,7 @@ module Gitlab end def ce_patch_name - @ce_patch_name ||= "#{ce_branch}.patch" + @ce_patch_name ||= patch_name_from_branch(ce_branch) end def ce_patch_full_path @@ -161,13 +161,17 @@ module Gitlab end def ee_patch_name - @ee_patch_name ||= "#{ee_branch}.patch" + @ee_patch_name ||= patch_name_from_branch(ee_branch) end def ee_patch_full_path @ee_patch_full_path ||= patches_dir.join(ee_patch_name) end + def patch_name_from_branch(branch_name) + branch_name.gsub(/[^\w-]/, '-') << '.patch' + end + def step(desc, cmd = nil) puts "\n=> #{desc}\n" |