optimize Gollum::Wiki#tree_list

This commit is contained in:
rick
2010-10-11 16:15:18 -07:00
parent 6552323797
commit 300d8eacc5
4 changed files with 18 additions and 12 deletions
+4 -3
View File
@@ -270,10 +270,11 @@ module Gollum
#
# Returns a Gollum::Page or nil if the page could not be found.
def find(name, version)
map = @wiki.tree_map_for(version)
map = @wiki.tree_map_for(version.to_s)
if page = find_page_in_tree(map, name)
page.version = @wiki.commit_for(version)
page.historical = page.version.id == version
page.version = version.is_a?(Grit::Commit) ?
version : @wiki.commit_for(version)
page.historical = page.version.to_s == version.to_s
page
end
rescue Grit::GitRuby::Repository::NoSuchShaFound