diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 6c5dbc95..8aa7d27d 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -945,6 +945,7 @@ def command(cmd, opts = [], chdir = true, redirect = '', &block) global_opts = [] global_opts << "--git-dir=#{@git_dir}" if !@git_dir.nil? global_opts << "--work-tree=#{@git_work_dir}" if !@git_work_dir.nil? + global_opts << ["-c", "color.ui=false"] opts = [opts].flatten.map {|s| escape(s) }.join(' ') diff --git a/tests/units/test_logger.rb b/tests/units/test_logger.rb index 7a54e0d3..b57ed102 100644 --- a/tests/units/test_logger.rb +++ b/tests/units/test_logger.rb @@ -19,7 +19,7 @@ def test_logger @git.branches.size logc = File.read(log.path) - assert(/INFO -- : git '--git-dir=[^']+' '--work-tree=[^']+' branch '-a'/.match(logc)) + assert(/INFO -- : git '--git-dir=[^']+' '--work-tree=[^']+' '-c' 'color.ui=false' branch '-a'/.match(logc)) assert(/DEBUG -- : diff_over_patches/.match(logc)) log = Tempfile.new('logfile') @@ -31,7 +31,7 @@ def test_logger @git.branches.size logc = File.read(log.path) - assert(/INFO -- : git '--git-dir=[^']+' '--work-tree=[^']+' branch '-a'/.match(logc)) + assert(/INFO -- : git '--git-dir=[^']+' '--work-tree=[^']+' '-c' 'color.ui=false' branch '-a'/.match(logc)) assert(!/DEBUG -- : diff_over_patches/.match(logc)) end