GitAccess#ref_to_sha should never return a blank string

This commit is contained in:
risk
2011-07-14 14:30:23 -07:00
parent 4abc32f1ec
commit bb06b566cd
+11 -7
View File
@@ -28,13 +28,17 @@ module Gollum
#
# ref - a String Git reference (ex: "master")
#
# Returns a String.
# Returns a String, or nil if the ref isn't found.
def ref_to_sha(ref)
if sha?(ref)
ref
else
get_cache(:ref, ref) { ref_to_sha!(ref) }
end
ref = ref.to_s
return if ref.empty?
sha =
if sha?(ref)
ref
else
get_cache(:ref, ref) { ref_to_sha!(ref) }
end.to_s
sha.empty? ? nil : sha
end
# Public: Gets a recursive list of Git blobs for the whole tree at the
@@ -238,4 +242,4 @@ module Gollum
path
end
end
end
end