Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boxiang Sun
gitlab-ce
Commits
7266c78b
Commit
7266c78b
authored
Apr 17, 2015
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of gitlab.com:gitlab-org/gitlab-ce
parents
5ba7a8e0
07c149de
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
5 deletions
+6
-5
app/models/namespace.rb
app/models/namespace.rb
+1
-0
db/migrate/20150324133047_remove_periods_at_ends_of_usernames.rb
...ate/20150324133047_remove_periods_at_ends_of_usernames.rb
+5
-5
No files found.
app/models/namespace.rb
View file @
7266c78b
...
@@ -59,6 +59,7 @@ class Namespace < ActiveRecord::Base
...
@@ -59,6 +59,7 @@ class Namespace < ActiveRecord::Base
end
end
def
clean_path
(
path
)
def
clean_path
(
path
)
path
=
path
.
dup
path
.
gsub!
(
/@.*\z/
,
""
)
path
.
gsub!
(
/@.*\z/
,
""
)
path
.
gsub!
(
/\.git\z/
,
""
)
path
.
gsub!
(
/\.git\z/
,
""
)
path
.
gsub!
(
/\A-+/
,
""
)
path
.
gsub!
(
/\A-+/
,
""
)
...
...
db/migrate/20150324133047_remove_periods_at_ends_of_usernames.rb
View file @
7266c78b
...
@@ -3,21 +3,21 @@ class RemovePeriodsAtEndsOfUsernames < ActiveRecord::Migration
...
@@ -3,21 +3,21 @@ class RemovePeriodsAtEndsOfUsernames < ActiveRecord::Migration
class
Namespace
<
ActiveRecord
::
Base
class
Namespace
<
ActiveRecord
::
Base
class
<<
self
class
<<
self
def
by_path
(
path
)
def
find_by_path_or_name
(
path
)
where
(
'lower(path) = :value'
,
value:
path
.
downcase
).
first
find_by
(
"lower(path) = :path OR lower(name) = :path"
,
path:
path
.
downcase
)
end
end
def
clean_path
(
path
)
def
clean_path
(
path
)
path
=
path
.
dup
path
=
path
.
dup
path
.
gsub!
(
/@.*\z/
,
""
)
path
.
gsub!
(
/@.*\z/
,
""
)
path
.
gsub!
(
/\.git\z/
,
""
)
path
.
gsub!
(
/\.git\z/
,
""
)
path
.
gsub!
(
/\A-
/
,
""
)
path
.
gsub!
(
/\A-
+/
,
""
)
path
.
gsub!
(
/
.\z/
,
""
)
path
.
gsub!
(
/
\.+\z/
,
""
)
path
.
gsub!
(
/[^a-zA-Z0-9_\-\.]/
,
""
)
path
.
gsub!
(
/[^a-zA-Z0-9_\-\.]/
,
""
)
counter
=
0
counter
=
0
base
=
path
base
=
path
while
Namespace
.
by_path
(
path
).
present?
while
Namespace
.
find_by_path_or_name
(
path
)
counter
+=
1
counter
+=
1
path
=
"
#{
base
}#{
counter
}
"
path
=
"
#{
base
}#{
counter
}
"
end
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