Skip to content

Commit 0e64b62

Browse files
author
Tim Morgan
committed
Return nil if the objectish doesn't exist
1 parent 01476ff commit 0e64b62

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/git/base.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ def config(name = nil, value = nil)
150150
# on the objectish and determine the type of the object and return
151151
# an appropriate object for that type
152152
def object(objectish)
153+
return nil unless objectish
153154
Git::Object.new(self, objectish)
155+
rescue Git::GitExecuteError
156+
return nil # unknown revision
154157
end
155158

156159
def gtree(objectish)

0 commit comments

Comments
 (0)