Skip to content

Commit

Permalink
Fix git executable search on windows.
Browse files Browse the repository at this point in the history
Make git up work in a msysgit shell.

Colouring remains messed up by default as ANSI colours should be
translated to Win32 calls.
  • Loading branch information
wernight committed Oct 23, 2012
1 parent 4cdb531 commit bdc23bd
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions lib/grit/git.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,15 @@ def select_existing_objects(object_ids)
class << self
attr_accessor :git_timeout, :git_max_size
def git_binary
if (/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM) != nil
git_filename = 'git.exe'
else
git_filename = 'git'
end
@git_binary ||=
ENV['PATH'].split(':').
map { |p| File.join(p, 'git') }.
ENV['PATH'].split(File::PATH_SEPARATOR).
map { |p| File.join(p, git_filename) }.
map { |p| p.gsub!('\\', '/') }.
find { |p| File.exist?(p) }
end
attr_writer :git_binary
Expand Down

0 comments on commit bdc23bd

Please sign in to comment.