locate git_binary on PATH at boot

Avoids starting a /bin/sh and /usr/bin/env process on each
native command invocation, and will allow exec'ing the
command directly.
This commit is contained in:
Ryan Tomayko 2010-12-09 01:03:16 -08:00
Родитель 6b7dff52aa
Коммит 2296c23d92
1 изменённых файлов: 3 добавлений и 5 удалений

Просмотреть файл

@ -37,11 +37,9 @@ module Grit
attr_accessor :git_binary, :git_timeout, :git_max_size
end
if RUBY_PLATFORM.downcase =~ /mswin(?!ce)|mingw|bccwin/
self.git_binary = "git" # using search path
else
self.git_binary = "/usr/bin/env git"
end
self.git_binary = ENV['PATH'].split(':').
map { |p| File.join(p, 'git') }.
find { |p| File.exist?(p) }
self.git_timeout = 10
self.git_max_size = 5242880 # 5.megabytes