From 9ee9e613128e69cfd28543ec2ff9af63846fb3e7 Mon Sep 17 00:00:00 2001 From: "Jeong, Heon" Date: Sat, 19 May 2012 14:43:30 +0900 Subject: [PATCH 1/3] Fix searching in page_dir if it exists This bug can cause DuplicateError even there is no such file in page_dir --- lib/gollum/committer.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gollum/committer.rb b/lib/gollum/committer.rb index e1911bdf..d7c43723 100644 --- a/lib/gollum/committer.rb +++ b/lib/gollum/committer.rb @@ -91,7 +91,7 @@ module Gollum fullpath = ::File.join(*[@wiki.page_file_dir, dir, path].compact) fullpath = fullpath[1..-1] if fullpath =~ /^\// - if index.current_tree && tree = index.current_tree / dir + if index.current_tree && tree = index.current_tree / (@wiki.page_file_dir || '/') / dir downpath = path.downcase.sub(/\.\w+$/, '') tree.blobs.each do |blob| From bbc19d180036bb14a3ed0411c72106eb6066e21e Mon Sep 17 00:00:00 2001 From: Neon Date: Thu, 24 May 2012 00:04:45 +0900 Subject: [PATCH 2/3] Added testcase for 'open existing parent' --- test/test_app.rb | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/test/test_app.rb b/test/test_app.rb index f83f9922..5eb90803 100644 --- a/test/test_app.rb +++ b/test/test_app.rb @@ -171,3 +171,34 @@ context "Frontend" do Precious::App end end + +context "Frontend with page-file-dir" do + include Rack::Test::Methods + + setup do + @path = cloned_testpath("examples/page_file_dir.git") + @wiki = Gollum::Wiki.new(@path, { :page_file_dir => "docs" }) + Precious::App.set(:gollum_path, @path) + Precious::App.set(:wiki_options, { :page_file_dir => "docs" }) + end + + teardown do + FileUtils.rm_rf(@path) + end + + test "open existing parent" do + get "/" + assert last_response.ok? + + post "/create", :content => "asdf", :page => "bar", + :format => 'markdown' + follow_redirect! + assert last_response.ok? + + assert_not_match /Duplicate page/, last_response.body + end + + def app + Precious::App + end +end From cc67c8b68ef926a7a0dd25fed21e7af54f2e88b1 Mon Sep 17 00:00:00 2001 From: bootstraponline Date: Sun, 3 Jun 2012 16:17:52 -0600 Subject: [PATCH 3/3] Don't use assert_not_match. --- test/test_app.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/test_app.rb b/test/test_app.rb index 5eb90803..04fee6e0 100644 --- a/test/test_app.rb +++ b/test/test_app.rb @@ -195,7 +195,8 @@ context "Frontend with page-file-dir" do follow_redirect! assert last_response.ok? - assert_not_match /Duplicate page/, last_response.body + # Assert not match. + assert_equal true, /Duplicate page/.match(last_response.body) == nil end def app