Skip to content

Commit

Permalink
fix issue with color escape codes after recent update of git binaries
Browse files Browse the repository at this point in the history
Signed-off-by: Marcel Hoyer <m.hoyer@cid.com>
  • Loading branch information
mhoyer committed Feb 10, 2020
1 parent c85dd82 commit 455b0b7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions lib/git/lib.rb
Expand Up @@ -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(' ')

Expand Down
4 changes: 2 additions & 2 deletions tests/units/test_logger.rb
Expand Up @@ -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')
Expand All @@ -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

Expand Down

0 comments on commit 455b0b7

Please sign in to comment.