OSDN Git Service

Extend Gitlab#default_regex. Dont allow project path ends with .git
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Wed, 13 Nov 2013 14:13:40 +0000 (16:13 +0200)
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Wed, 13 Nov 2013 14:13:40 +0000 (16:13 +0200)
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/views/projects/edit.html.haml
lib/gitlab/regex.rb

index ebe5858..3afc607 100644 (file)
                 %span Path
               .controls
                 .control-group
-                  = f.text_field :path
+                  .input-append
+                    = f.text_field :path
+                    %span.add-on .git
                 %ul
                   %li Be careful. Renaming a project's repository can have unintended side effects.
                   %li You will need to update your local repositories to point to the new location.
index 55aa240..eb6b91e 100644 (file)
@@ -44,7 +44,7 @@ module Gitlab
     protected
 
     def default_regex
-      /\A[a-zA-Z0-9][a-zA-Z0-9_\-\.]*\z/
+      /\A[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
     end
   end
 end