diff --git a/bin/gollum b/bin/gollum index a3aa6bc1..8cbb5c40 100755 --- a/bin/gollum +++ b/bin/gollum @@ -111,6 +111,12 @@ MSG opts.on("--no-live-preview", "Disable the live preview feature in page editor.") do wiki_options[:live_preview] = false end + opts.on("--follow-renames", "Follow pages across renames in the History view. Default except on jruby.") do + wiki_options[:follow_renames] = true + end + opts.on("--no-follow-renames", "Do not follow pages across renames in the History view.") do + wiki_options[:follow_renames] = false + end opts.on("--allow-uploads [MODE]", [:dir, :page], "Enable file uploads.", "If set to 'dir', Gollum will store all uploads in the '/uploads/' directory.", "If set to 'page', Gollum will store each upload at the currently edited page.") do |mode| diff --git a/lib/gollum/app.rb b/lib/gollum/app.rb index 7a951d43..dc84ab52 100644 --- a/lib/gollum/app.rb +++ b/lib/gollum/app.rb @@ -404,7 +404,7 @@ module Precious @page = wiki_page(params[:splat].first).page @page_num = [params[:page].to_i, 1].max unless @page.nil? - @versions = @page.versions :page => @page_num + @versions = @page.versions(:page => @page_num, :follow => settings.wiki_options.fetch(:follow_renames, git_adapter == 'rjgit' ? false : true)) mustache :history else redirect to("/") diff --git a/lib/gollum/helpers.rb b/lib/gollum/helpers.rb index b83d56ce..b080e0dc 100644 --- a/lib/gollum/helpers.rb +++ b/lib/gollum/helpers.rb @@ -6,6 +6,10 @@ module Precious EMOJI_PATHNAME = Pathname.new(Gemojione.images_path).freeze + def git_adapter + defined?(Gollum::GIT_ADAPTER) ? Gollum::GIT_ADAPTER : DEFAULT_ADAPTER.match(/(.*)_adapter/)[1] + end + def join_page_name(name, ext) "#{name}#{ext}" end diff --git a/test/test_app_helpers.rb b/test/test_app_helpers.rb index 549afff2..fcbea6e3 100644 --- a/test/test_app_helpers.rb +++ b/test/test_app_helpers.rb @@ -4,6 +4,15 @@ require File.expand_path(File.join(File.dirname(__FILE__), "helper")) context "Precious::Helpers" do include Precious::Helpers + test "return git adapter" do + if defined?(Gollum::GIT_ADAPTER) + result = Gollum::GIT_ADAPTER + else + Gollum::GIT_ADAPTER = result = 'grit' + end + assert_equal result, git_adapter + end + test "extracting paths from URLs" do assert_nil extract_path('Eye-Of-Sauron') assert_equal 'Mordor', extract_path('Mordor/Sauron')