From c7e172f5ca66ed7861a3174894b810d9eb354386 Mon Sep 17 00:00:00 2001 From: rick Date: Mon, 16 Aug 2010 14:57:39 -0700 Subject: [PATCH] can't access trees as files --- lib/gollum/file.rb | 2 +- test/test_file.rb | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/gollum/file.rb b/lib/gollum/file.rb index 2f2b41e7..20ceeec8 100644 --- a/lib/gollum/file.rb +++ b/lib/gollum/file.rb @@ -47,7 +47,7 @@ module Gollum # Returns a Gollum::File or nil if the file could not be found. def find(name, version) if commit = @wiki.repo.commit(version) - if blob = commit.tree / name + if (blob = commit.tree / name) && blob.is_a?(Grit::Blob) @blob = blob @path = name @version = commit diff --git a/test/test_file.rb b/test/test_file.rb index 4a2c6129..bcb507c4 100644 --- a/test/test_file.rb +++ b/test/test_file.rb @@ -15,4 +15,8 @@ context "File" do assert_equal "[ ] Write section on Ents\n", file.raw_data assert_equal @wiki.repo.commits.first.id, file.version.id end + + test "accessing tree" do + assert_nil @wiki.file("Mordor") + end end \ No newline at end of file