Use root ref instead of HEAD to find latest repository commit
This commit is contained in:
parent
4473b685d6
commit
d8f0db0197
|
@ -99,11 +99,11 @@ class Repository
|
||||||
"#<#{self.class.name}:#{@disk_path}>"
|
"#<#{self.class.name}:#{@disk_path}>"
|
||||||
end
|
end
|
||||||
|
|
||||||
def commit(ref = 'HEAD')
|
def commit(ref = nil)
|
||||||
return nil unless exists?
|
return nil unless exists?
|
||||||
return ref if ref.is_a?(::Commit)
|
return ref if ref.is_a?(::Commit)
|
||||||
|
|
||||||
find_commit(ref)
|
find_commit(ref || root_ref)
|
||||||
end
|
end
|
||||||
|
|
||||||
# Finding a commit by the passed SHA
|
# Finding a commit by the passed SHA
|
||||||
|
|
Loading…
Reference in New Issue