Commit 64edb27aa95cef237564b2f6dad38ba6208f3745

Authored by Dmitriy Zaporozhets
1 parent 31239d11

Extend Gitlab#default_regex. Dont allow project path ends with .git

Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
app/views/projects/edit.html.haml
@@ -144,7 +144,9 @@ @@ -144,7 +144,9 @@
144 %span Path 144 %span Path
145 .controls 145 .controls
146 .control-group 146 .control-group
147 - = f.text_field :path 147 + .input-append
  148 + = f.text_field :path
  149 + %span.add-on .git
148 %ul 150 %ul
149 %li Be careful. Renaming a project's repository can have unintended side effects. 151 %li Be careful. Renaming a project's repository can have unintended side effects.
150 %li You will need to update your local repositories to point to the new location. 152 %li You will need to update your local repositories to point to the new location.
lib/gitlab/regex.rb
@@ -44,7 +44,7 @@ module Gitlab @@ -44,7 +44,7 @@ module Gitlab
44 protected 44 protected
45 45
46 def default_regex 46 def default_regex
47 - /\A[a-zA-Z0-9][a-zA-Z0-9_\-\.]*\z/ 47 + /\A[a-zA-Z0-9][a-zA-Z0-9_\-\.]*(?<!\.git)\z/
48 end 48 end
49 end 49 end
50 end 50 end