Commit 10fac475 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'wiki_backup' of /home/git/repositories/gitlab/gitlabhq

parents 9fa94cad cb6a86ed
No related merge requests found
......@@ -45,6 +45,10 @@ class GollumWiki
end
end
def empty?
pages.empty?
end
# Returns an Array of Gitlab WikiPage instances or an
# empty Array if this Wiki has no pages.
def pages
......
......@@ -28,7 +28,9 @@ module Backup
if File.exists?(path_to_repo(wiki))
print " * #{wiki.path_with_namespace} ... "
if system("cd #{path_to_repo(wiki)} > /dev/null 2>&1 && git bundle create #{path_to_bundle(wiki)} --all > /dev/null 2>&1")
if wiki.empty?
puts " [SKIPPED]".cyan
elsif system("cd #{path_to_repo(wiki)} > /dev/null 2>&1 && git bundle create #{path_to_bundle(wiki)} --all > /dev/null 2>&1")
puts " [DONE]".green
else
puts " [FAILED]".red
......
......@@ -86,6 +86,27 @@ describe GollumWiki do
end
end
describe "#empty?" do
context "when the wiki repository is empty" do
before do
Gitlab::Shell.any_instance.stub(:add_repository) do
create_temp_repo("#{Rails.root}/tmp/test-git-base-path/non-existant.wiki.git")
end
project.stub(:path_with_namespace).and_return("non-existant")
end
its(:empty?) { should be_true }
end
context "when the wiki has pages" do
before do
create_page("index", "This is an awesome new Gollum Wiki")
end
its(:empty?) { should be_false }
end
end
describe "#pages" do
before do
create_page("index", "This is an awesome new Gollum Wiki")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment