Commit 10fac475277f469556ddc3ef274743d8776eae74
Exists in
master
and in
4 other branches
Merge branch 'wiki_backup' of /home/git/repositories/gitlab/gitlabhq
Showing
3 changed files
with
28 additions
and
1 deletions
Show diff stats
app/models/gollum_wiki.rb
lib/backup/repository.rb
... | ... | @@ -28,7 +28,9 @@ module Backup |
28 | 28 | |
29 | 29 | if File.exists?(path_to_repo(wiki)) |
30 | 30 | print " * #{wiki.path_with_namespace} ... " |
31 | - if system("cd #{path_to_repo(wiki)} > /dev/null 2>&1 && git bundle create #{path_to_bundle(wiki)} --all > /dev/null 2>&1") | |
31 | + if wiki.empty? | |
32 | + puts " [SKIPPED]".cyan | |
33 | + elsif system("cd #{path_to_repo(wiki)} > /dev/null 2>&1 && git bundle create #{path_to_bundle(wiki)} --all > /dev/null 2>&1") | |
32 | 34 | puts " [DONE]".green |
33 | 35 | else |
34 | 36 | puts " [FAILED]".red | ... | ... |
spec/models/gollum_wiki_spec.rb
... | ... | @@ -86,6 +86,27 @@ describe GollumWiki do |
86 | 86 | end |
87 | 87 | end |
88 | 88 | |
89 | + describe "#empty?" do | |
90 | + context "when the wiki repository is empty" do | |
91 | + before do | |
92 | + Gitlab::Shell.any_instance.stub(:add_repository) do | |
93 | + create_temp_repo("#{Rails.root}/tmp/test-git-base-path/non-existant.wiki.git") | |
94 | + end | |
95 | + project.stub(:path_with_namespace).and_return("non-existant") | |
96 | + end | |
97 | + | |
98 | + its(:empty?) { should be_true } | |
99 | + end | |
100 | + | |
101 | + context "when the wiki has pages" do | |
102 | + before do | |
103 | + create_page("index", "This is an awesome new Gollum Wiki") | |
104 | + end | |
105 | + | |
106 | + its(:empty?) { should be_false } | |
107 | + end | |
108 | + end | |
109 | + | |
89 | 110 | describe "#pages" do |
90 | 111 | before do |
91 | 112 | create_page("index", "This is an awesome new Gollum Wiki") | ... | ... |