Use root ref instead of HEAD to find latest repository commit

This commit is contained in:
Grzegorz Bizon 2018-06-29 09:02:22 +02:00
parent 4473b685d6
commit d8f0db0197
1 changed files with 2 additions and 2 deletions

View File

@ -99,11 +99,11 @@ class Repository
"#<#{self.class.name}:#{@disk_path}>"
end
def commit(ref = 'HEAD')
def commit(ref = nil)
return nil unless exists?
return ref if ref.is_a?(::Commit)
find_commit(ref)
find_commit(ref || root_ref)
end
# Finding a commit by the passed SHA