提交 7a3e43cc 编写于 作者: A Aaron Patterson

Merge pull request #4452 from tapajos/e5425c8f

Fix cache (FileStore) clear to keep .gitkeep.
......@@ -23,7 +23,7 @@ def initialize(cache_path, options = nil)
end
def clear(options = nil)
root_dirs = Dir.entries(cache_path).reject{|f| f.in?(EXCLUDED_DIRS)}
root_dirs = Dir.entries(cache_path).reject{|f| f.in?(EXCLUDED_DIRS + [".gitkeep"])}
FileUtils.rm_r(root_dirs.collect{|f| File.join(cache_path, f)})
end
......
......@@ -568,6 +568,13 @@ def cache_dir
include CacheDeleteMatchedBehavior
include CacheIncrementDecrementBehavior
def test_clear
filepath = File.join(cache_dir, ".gitkeep")
FileUtils.touch(filepath)
@cache.clear
assert File.exist?(filepath)
end
def test_key_transformation
key = @cache.send(:key_file_path, "views/index?id=1")
assert_equal "views/index?id=1", @cache.send(:file_path_key, key)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册