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:
authorMatthieu Tardy <matthieu.tardy@gmail.com>2017-01-09 09:38:13 +0300
committerMatthieu Tardy <matthieu.tardy@gmail.com>2017-01-09 15:38:44 +0300
commit7a399b7061d4d374f01ddaa75ae7fba53ca4cb6b (patch)
tree352434b3ef7a708c5bc3c9d8453053d52635ed65 /lib/gitlab/git_ref_validator.rb
parent8ab94120ee0a87c7b1158ebafea101e3952ec758 (diff)
Strip reference prefixes on branch creation
Signed-off-by: Matthieu Tardy <matthieu.tardy@gmail.com>
Diffstat (limited to 'lib/gitlab/git_ref_validator.rb')
-rw-r--r--lib/gitlab/git_ref_validator.rb3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/gitlab/git_ref_validator.rb b/lib/gitlab/git_ref_validator.rb
index 4d83d8e72a8..0e87ee30c98 100644
--- a/lib/gitlab/git_ref_validator.rb
+++ b/lib/gitlab/git_ref_validator.rb
@@ -5,6 +5,9 @@ module Gitlab
#
# Returns true for a valid reference name, false otherwise
def validate(ref_name)
+ return false if ref_name.start_with?('refs/heads/')
+ return false if ref_name.start_with?('refs/remotes/')
+
Gitlab::Utils.system_silent(
%W(#{Gitlab.config.git.bin_path} check-ref-format refs/#{ref_name}))
end