diff --git a/lib/gollum/file.rb b/lib/gollum/file.rb index d641d720..75faf366 100644 --- a/lib/gollum/file.rb +++ b/lib/gollum/file.rb @@ -1,6 +1,6 @@ module Gollum class File - attr_accessor :wiki, :blob + attr_accessor :wiki, :blob, :version # Initialize a file. # @@ -28,6 +28,7 @@ module Gollum commit = self.wiki.repo.commit(version) if blob = commit.tree / name self.blob = blob + self.version = commit self else nil diff --git a/test/test_file.rb b/test/test_file.rb index 8b96e5e7..4a2c6129 100644 --- a/test/test_file.rb +++ b/test/test_file.rb @@ -13,5 +13,6 @@ context "File" do test "existing file" do file = @wiki.file("Mordor/todo.txt") assert_equal "[ ] Write section on Ents\n", file.raw_data + assert_equal @wiki.repo.commits.first.id, file.version.id end end \ No newline at end of file