Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
7fd98a1cd39a
Commit
7266c78b
authored
Apr 17, 2015
by
Dmitriy Zaporozhets
Browse files
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
parents
a74319d6d9f5
6c2a076bf9b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/models/namespace.rb
View file @
7fd98a1c
...
...
@@ -59,6 +59,7 @@ def search(query)
end
def
clean_path
(
path
)
path
=
path
.
dup
path
.
gsub!
(
/@.*\z/
,
""
)
path
.
gsub!
(
/\.git\z/
,
""
)
path
.
gsub!
(
/\A-+/
,
""
)
...
...
db/migrate/20150324133047_remove_periods_at_ends_of_usernames.rb
View file @
7fd98a1c
...
...
@@ -3,21 +3,21 @@ class RemovePeriodsAtEndsOfUsernames < ActiveRecord::Migration
class
Namespace
<
ActiveRecord
::
Base
class
<<
self
def
by_path
(
path
)
where
(
'
lower(path) = :
value'
,
value
:
path
.
downcase
)
.
first
def
find_
by_path
_or_name
(
path
)
find_by
(
"
lower(path) = :
path OR lower(name) = :path"
,
path
:
path
.
downcase
)
end
def
clean_path
(
path
)
path
=
path
.
dup
path
.
gsub!
(
/@.*\z/
,
""
)
path
.
gsub!
(
/\.git\z/
,
""
)
path
.
gsub!
(
/\A-/
,
""
)
path
.
gsub!
(
/
.
\z/
,
""
)
path
.
gsub!
(
/\A-
+
/
,
""
)
path
.
gsub!
(
/
\.+
\z/
,
""
)
path
.
gsub!
(
/[^a-zA-Z0-9_\-\.]/
,
""
)
counter
=
0
base
=
path
while
Namespace
.
by_path
(
path
).
present?
while
Namespace
.
find_
by_path
_or_name
(
path
)
counter
+=
1
path
=
"
#{
base
}#{
counter
}
"
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment