lib/heirloom/directory/git_directory.rb in heirloom-0.3.0 vs lib/heirloom/directory/git_directory.rb in heirloom-0.3.1
- old
+ new
@@ -4,18 +4,21 @@
module Heirloom
class GitDirectory
- attr_accessor :path
-
def initialize(args)
- self.path = args[:path]
+ @path = args[:path]
end
def commit(sha = nil)
- repo = Repo.new path
- sha ? repo.commits(sha).first : repo.commits.first
+ repo = Repo.new @path
+ if sha
+ commit = repo.commits(sha)
+ commit ? commit.first : false
+ else
+ repo.commits.first
+ end
end
end
end