From: Jean-Philippe Lang Date: Wed, 12 Mar 2008 23:09:11 +0000 (+0000) Subject: Prevent unexpected nil error in GitAdapter#info if the repository path is invalid. X-Git-Tag: 0.7.0-RC1~65 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ea161c9ea408ea47ccef67f1a712c51194e9084f;p=redmine.git Prevent unexpected nil error in GitAdapter#info if the repository path is invalid. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1239 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- diff --git a/lib/redmine/scm/adapters/git_adapter.rb b/lib/redmine/scm/adapters/git_adapter.rb index b6b1b858d..088f83af7 100644 --- a/lib/redmine/scm/adapters/git_adapter.rb +++ b/lib/redmine/scm/adapters/git_adapter.rb @@ -94,11 +94,12 @@ module Redmine def info - root_url = target('') - info = Info.new({:root_url => target(''), - :lastrev => revisions(root_url,nil,nil,{:limit => 1}).first - }) - info + revs = revisions(url,nil,nil,{:limit => 1}) + if revs && revs.any? + Info.new(:root_url => url, :lastrev => revs.first) + else + nil + end rescue Errno::ENOENT => e return nil end