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
44f9ec35
Commit
44f9ec35
authored
Jun 19, 2020
by
Alex Kalderimis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove unnecessary nil-checks
parent
9b260b67
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
lib/gitlab/gl_repository/identifier.rb
lib/gitlab/gl_repository/identifier.rb
+7
-7
No files found.
lib/gitlab/gl_repository/identifier.rb
View file @
44f9ec35
...
...
@@ -11,8 +11,6 @@ module Gitlab
segments
=
gl_repository
&
.
split
(
'-'
)
# gl_repository can either have 2 or 3 segments:
# "wiki-1" is the older 2-segment format, where container is implied.
# "group-1-wiki" is the newer 3-segment format, including container information.
#
# TODO: convert all 2-segment format to 3-segment:
# https://gitlab.com/gitlab-org/gitlab/-/issues/219192
...
...
@@ -28,6 +26,8 @@ module Gitlab
raise
InvalidIdentifier
,
%Q(Invalid GL Repository "
#{
gl_repository
}
")
end
# The older 2-segment format, where the container is implied.
# eg. project-1, wiki-1
class
TwoPartIdentifier
<
Identifier
def
initialize
(
repo_type_name
,
container_id_str
)
@container_id_str
=
container_id_str
...
...
@@ -37,10 +37,12 @@ module Gitlab
private
def
container_class
repo_type
&
.
container_class
repo_type
.
container_class
end
end
# The newer 3-segment format, where the container is explicit
# eg. group-1-wiki, project-1-wiki
class
ThreePartIdentifier
<
Identifier
def
initialize
(
container_type
,
container_id_str
,
repo_type_name
)
@container_id_str
=
container_id_str
...
...
@@ -61,13 +63,11 @@ module Gitlab
end
def
repo_type
strong_memoize
(
:repo_type
)
{
Gitlab
::
GlRepository
.
types
[
repo_type_name
]
}
strong_memoize
(
:repo_type
)
{
Gitlab
::
GlRepository
.
types
[
repo_type_name
]
}
end
def
container
strong_memoize
(
:container
)
do
container_class
&
.
find_by_id
(
container_id
)
if
container_id
end
strong_memoize
(
:container
)
{
container_class
.
find_by_id
(
container_id
)
}
end
def
valid?
...
...
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