2014-07-27 14:40:00 +00:00
|
|
|
module Gitlab
|
|
|
|
module GitRefValidator
|
|
|
|
extend self
|
|
|
|
# Validates a given name against the git reference specification
|
|
|
|
#
|
|
|
|
# Returns true for a valid reference name, false otherwise
|
|
|
|
def validate(ref_name)
|
2014-11-06 11:07:16 +00:00
|
|
|
Gitlab::Utils.system_silent(
|
|
|
|
%W(git check-ref-format refs/#{ref_name})) == 0
|
2014-07-27 14:40:00 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|