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
e0b5306c
Commit
e0b5306c
authored
Nov 16, 2018
by
Matija Čupić
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove Repository#find_ref
parent
96a0a8cf
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
46 deletions
+0
-46
app/models/repository.rb
app/models/repository.rb
+0
-10
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+0
-36
No files found.
app/models/repository.rb
View file @
e0b5306c
...
@@ -182,16 +182,6 @@ class Repository
...
@@ -182,16 +182,6 @@ class Repository
tags
.
find
{
|
tag
|
tag
.
name
==
name
}
tags
.
find
{
|
tag
|
tag
.
name
==
name
}
end
end
def
find_ref
(
ref
)
if
Gitlab
::
Git
.
tag_ref?
(
ref
)
find_tag
(
Gitlab
::
Git
.
ref_name
(
ref
))
elsif
Gitlab
::
Git
.
branch_ref?
(
ref
)
find_branch
(
Gitlab
::
Git
.
ref_name
(
ref
))
else
nil
end
end
def
add_branch
(
user
,
branch_name
,
ref
)
def
add_branch
(
user
,
branch_name
,
ref
)
branch
=
raw_repository
.
add_branch
(
branch_name
,
user:
user
,
target:
ref
)
branch
=
raw_repository
.
add_branch
(
branch_name
,
user:
user
,
target:
ref
)
...
...
spec/models/repository_spec.rb
View file @
e0b5306c
...
@@ -1699,42 +1699,6 @@ describe Repository do
...
@@ -1699,42 +1699,6 @@ describe Repository do
end
end
end
end
describe
'#find_ref'
do
subject
{
repository
.
find_ref
(
ref
)
}
context
'when ref is a tag'
do
let
(
:ref
)
{
'refs/tags/v1.0.0'
}
it
'returns a tag'
do
is_expected
.
to
be_a
(
Gitlab
::
Git
::
Tag
)
end
it
'returns the correct tag'
do
expect
(
subject
.
name
).
to
eq
(
'v1.0.0'
)
end
end
context
'when ref is a branch'
do
let
(
:ref
)
{
'refs/heads/master'
}
it
'returns a branch'
do
is_expected
.
to
be_a
(
Gitlab
::
Git
::
Branch
)
end
it
'returns the correct branch'
do
expect
(
subject
.
name
).
to
eq
(
'master'
)
end
end
context
'when ref is invalid'
do
let
(
:ref
)
{
'refs/notvalid/ref'
}
it
'returns nil'
do
is_expected
.
to
eq
(
nil
)
end
end
end
describe
'#avatar'
do
describe
'#avatar'
do
it
'returns nil if repo does not exist'
do
it
'returns nil if repo does not exist'
do
allow
(
repository
).
to
receive
(
:root_ref
).
and_raise
(
Gitlab
::
Git
::
Repository
::
NoRepository
)
allow
(
repository
).
to
receive
(
:root_ref
).
and_raise
(
Gitlab
::
Git
::
Repository
::
NoRepository
)
...
...
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