BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
93ad8344
Commit
93ad8344
authored
Aug 24, 2017
by
Douwe Maan
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'sh-fix-branch-count' into 'master'
Fix inconsistent number of branches when remote branches are present Closes #36934 See merge request !13784
parents
19dfd9e9
37904108
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
1 deletion
+31
-1
repository.rb
lib/gitlab/git/repository.rb
+1
-1
repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+30
-0
No files found.
lib/gitlab/git/repository.rb
View file @
93ad8344
...
...
@@ -153,7 +153,7 @@ module Gitlab
if
is_enabled
gitaly_ref_client
.
count_branch_names
else
rugged
.
branches
.
count
do
|
ref
|
rugged
.
branches
.
each
(
:local
).
count
do
|
ref
|
begin
ref
.
name
&&
ref
.
target
# ensures the branch is valid
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
93ad8344
...
...
@@ -977,6 +977,36 @@ describe Gitlab::Git::Repository, seed_helper: true do
it
'returns the number of branches'
do
expect
(
repository
.
branch_count
).
to
eq
(
10
)
end
context
'with local and remote branches'
do
let
(
:repository
)
do
Gitlab
::
Git
::
Repository
.
new
(
'default'
,
File
.
join
(
TEST_MUTABLE_REPO_PATH
,
'.git'
))
end
before
do
create_remote_branch
(
repository
,
'joe'
,
'remote_branch'
,
'master'
)
repository
.
create_branch
(
'local_branch'
,
'master'
)
end
after
do
FileUtils
.
rm_rf
(
TEST_MUTABLE_REPO_PATH
)
ensure_seeds
end
it
'returns the count of local branches'
do
expect
(
repository
.
branch_count
).
to
eq
(
repository
.
local_branches
.
count
)
end
context
'with Gitaly disabled'
do
before
do
allow
(
Gitlab
::
GitalyClient
).
to
receive
(
:feature_enabled?
).
and_return
(
false
)
end
it
'returns the count of local branches'
do
expect
(
repository
.
branch_count
).
to
eq
(
repository
.
local_branches
.
count
)
end
end
end
end
describe
"#ls_files"
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