diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2014-07-27 18:40:00 +0400 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2014-09-03 15:08:35 +0400 |
commit | 551145bc98e257280b615e305d531a44d7aa4131 (patch) | |
tree | 20a853ca41d610247f955a9c8824ba50b18d3220 /lib/gitlab/git_ref_validator.rb | |
parent | 7a0e1c7238033b33b7296701bfded56d4ad7f250 (diff) |
Validate branch-names and references in WebUI, API
Add specs for GitRefValidator
Diffstat (limited to 'lib/gitlab/git_ref_validator.rb')
-rw-r--r-- | lib/gitlab/git_ref_validator.rb | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/gitlab/git_ref_validator.rb b/lib/gitlab/git_ref_validator.rb new file mode 100644 index 00000000000..13cb08948bb --- /dev/null +++ b/lib/gitlab/git_ref_validator.rb @@ -0,0 +1,11 @@ +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) + system *%W(git check-ref-format refs/#{ref_name}) + end + end +end |