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
3ed4a1b3
Commit
3ed4a1b3
authored
Jun 14, 2018
by
Zeger-Jan van de Weg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
HasLocalBranches check is done by Gitaly only
Closes
https://gitlab.com/gitlab-org/gitaly/issues/217
parent
89ab32c6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
27 deletions
+3
-27
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+2
-18
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+1
-9
No files found.
lib/gitlab/git/repository.rb
View file @
3ed4a1b3
...
@@ -235,18 +235,6 @@ module Gitlab
...
@@ -235,18 +235,6 @@ module Gitlab
# This refs by default not visible in project page and not cloned to client side.
# This refs by default not visible in project page and not cloned to client side.
alias_method
:has_visible_content?
,
:has_local_branches?
alias_method
:has_visible_content?
,
:has_local_branches?
def
has_local_branches_rugged?
rugged
.
branches
.
each
(
:local
).
any?
do
|
ref
|
begin
ref
.
name
&&
ref
.
target
# ensures the branch is valid
true
rescue
Rugged
::
ReferenceError
false
end
end
end
# Returns the number of valid tags
# Returns the number of valid tags
def
tag_count
def
tag_count
gitaly_migrate
(
:tag_names
)
do
|
is_enabled
|
gitaly_migrate
(
:tag_names
)
do
|
is_enabled
|
...
@@ -1573,12 +1561,8 @@ module Gitlab
...
@@ -1573,12 +1561,8 @@ module Gitlab
private
private
def
uncached_has_local_branches?
def
uncached_has_local_branches?
gitaly_migrate
(
:has_local_branches
,
status:
Gitlab
::
GitalyClient
::
MigrationStatus
::
OPT_OUT
)
do
|
is_enabled
|
wrapped_gitaly_errors
do
if
is_enabled
gitaly_repository_client
.
has_local_branches?
gitaly_repository_client
.
has_local_branches?
else
has_local_branches_rugged?
end
end
end
end
end
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
3ed4a1b3
...
@@ -425,7 +425,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
...
@@ -425,7 +425,7 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
describe
'#has_local_branches?'
do
describe
'#has_local_branches?'
do
shared_examples
'check for local branches'
do
context
'check for local branches'
do
it
{
expect
(
repository
.
has_local_branches?
).
to
eq
(
true
)
}
it
{
expect
(
repository
.
has_local_branches?
).
to
eq
(
true
)
}
context
'mutable'
do
context
'mutable'
do
...
@@ -459,14 +459,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
...
@@ -459,14 +459,6 @@ describe Gitlab::Git::Repository, seed_helper: true do
end
end
end
end
end
end
context
'with gitaly'
do
it_behaves_like
'check for local branches'
end
context
'without gitaly'
,
:skip_gitaly_mock
do
it_behaves_like
'check for local branches'
end
end
end
describe
"#delete_branch"
do
describe
"#delete_branch"
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