From 455b0b75845ea73413295cfba2827f0b36c1443e Mon Sep 17 00:00:00 2001 From: Marcel Hoyer Date: Mon, 10 Feb 2020 11:16:44 +0100 Subject: [PATCH] fix issue with color escape codes after recent update of `git` binaries Signed-off-by: Marcel Hoyer --- lib/git/lib.rb | 1 + tests/units/test_logger.rb | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) 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