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
Jérome Perrin
gitlab-ce
Commits
74e5ec19
Commit
74e5ec19
authored
Apr 14, 2018
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix failing ./spec/lib/backup/repository_spec.rb by clearing the memoized value
parent
b1f15dfa
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
1 deletion
+13
-1
app/models/repository.rb
app/models/repository.rb
+1
-0
lib/gitlab/git/repository.rb
lib/gitlab/git/repository.rb
+4
-0
spec/lib/gitlab/git/repository_spec.rb
spec/lib/gitlab/git/repository_spec.rb
+2
-1
spec/models/repository_spec.rb
spec/models/repository_spec.rb
+6
-0
No files found.
app/models/repository.rb
View file @
74e5ec19
...
...
@@ -331,6 +331,7 @@ class Repository
return
unless
empty?
expire_method_caches
(
%i(has_visible_content?)
)
raw_repository
.
expire_has_local_branches_cache
end
def
lookup_cache
...
...
lib/gitlab/git/repository.rb
View file @
74e5ec19
...
...
@@ -232,6 +232,10 @@ module Gitlab
end
end
def
expire_has_local_branches_cache
clear_memoization
(
:has_local_branches
)
end
def
has_local_branches?
strong_memoize
(
:has_local_branches
)
do
uncached_has_local_branches?
...
...
spec/lib/gitlab/git/repository_spec.rb
View file @
74e5ec19
...
...
@@ -463,13 +463,14 @@ describe Gitlab::Git::Repository, seed_helper: true do
it
'returns false when there are no branches'
do
# Sanity check
expect
(
repository
.
uncached_
has_local_branches?
).
to
eq
(
true
)
expect
(
repository
.
has_local_branches?
).
to
eq
(
true
)
FileUtils
.
rm_rf
(
File
.
join
(
repository
.
path
,
'packed-refs'
))
heads_dir
=
File
.
join
(
repository
.
path
,
'refs/heads'
)
FileUtils
.
rm_rf
(
heads_dir
)
FileUtils
.
mkdir_p
(
heads_dir
)
repository
.
expire_has_local_branches_cache
expect
(
repository
.
has_local_branches?
).
to
eq
(
false
)
end
end
...
...
spec/models/repository_spec.rb
View file @
74e5ec19
...
...
@@ -1437,6 +1437,12 @@ describe Repository do
repository
.
expire_emptiness_caches
end
it
'expires the memoized repository cache'
do
allow
(
repository
.
raw_repository
).
to
receive
(
:expire_has_local_branches_cache
).
and_call_original
repository
.
expire_emptiness_caches
end
end
describe
'skip_merges option'
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