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
460badd8
Commit
460badd8
authored
Sep 04, 2018
by
Douglas Barbosa Alexandre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Gitlab::Git::Repository#find_remote_root_ref
parent
21096e23
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
0 deletions
+35
-0
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+8
-0
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+27
-0
No files found.
lib/gitlab/git/repository.rb
View file @
460badd8
...
...
@@ -666,6 +666,14 @@ module Gitlab
end
end
def
find_remote_root_ref
(
remote_name
)
return
unless
remote_name
.
present?
wrapped_gitaly_errors
do
gitaly_remote_client
.
find_remote_root_ref
(
remote_name
)
end
end
AUTOCRLF_VALUES
=
{
"true"
=>
true
,
"false"
=>
false
,
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
460badd8
...
...
@@ -583,6 +583,33 @@ describe Gitlab::Git::Repository, :seed_helper do
end
end
describe
'#find_remote_root_ref'
do
it
'gets the remote root ref from GitalyClient'
do
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
RemoteService
)
.
to
receive
(
:find_remote_root_ref
).
and_call_original
expect
(
repository
.
find_remote_root_ref
(
'origin'
)).
to
eq
'master'
end
it
'returns nil when remote name is nil'
do
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
RemoteService
)
.
not_to
receive
(
:find_remote_root_ref
)
expect
(
repository
.
find_remote_root_ref
(
nil
)).
to
be_nil
end
it
'returns nil when remote name is empty'
do
expect_any_instance_of
(
Gitlab
::
GitalyClient
::
RemoteService
)
.
not_to
receive
(
:find_remote_root_ref
)
expect
(
repository
.
find_remote_root_ref
(
''
)).
to
be_nil
end
it_behaves_like
'wrapping gRPC errors'
,
Gitlab
::
GitalyClient
::
RemoteService
,
:find_remote_root_ref
do
subject
{
repository
.
find_remote_root_ref
(
'origin'
)
}
end
end
describe
"#log"
do
shared_examples
'repository log'
do
let
(
:commit_with_old_name
)
do
...
...
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