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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
917a112e
Commit
917a112e
authored
Dec 10, 2017
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify normalizing of paths
parent
e8cced80
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
4 deletions
+3
-4
lib/gitlab/bare_repository_import/repository.rb
lib/gitlab/bare_repository_import/repository.rb
+3
-4
No files found.
lib/gitlab/bare_repository_import/repository.rb
View file @
917a112e
...
@@ -7,6 +7,8 @@ module Gitlab
...
@@ -7,6 +7,8 @@ module Gitlab
@root_path
=
root_path
@root_path
=
root_path
@repo_path
=
repo_path
@repo_path
=
repo_path
@root_path
<<
'/'
unless
root_path
.
ends_with?
(
'/'
)
# Split path into 'all/the/namespaces' and 'project_name'
# Split path into 'all/the/namespaces' and 'project_name'
@group_path
,
_
,
@project_name
=
repo_relative_path
.
rpartition
(
'/'
)
@group_path
,
_
,
@project_name
=
repo_relative_path
.
rpartition
(
'/'
)
end
end
...
@@ -34,11 +36,8 @@ module Gitlab
...
@@ -34,11 +36,8 @@ module Gitlab
private
private
def
repo_relative_path
def
repo_relative_path
absolute_path
=
Pathname
.
new
(
repo_path
)
project_root
=
Pathname
.
new
(
@root_path
)
# Remove root path and `.git` at the end
# Remove root path and `.git` at the end
absolute_path
.
relative_path_from
(
project_root
).
to_s
.
gsub
(
/\.git$/
,
''
)
repo_path
[
@root_path
.
size
...-
4
]
end
end
end
end
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