Skip to content

current_branch contains color escape codes #427

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix issue with color escape codes after recent update of git binaries
Signed-off-by: Marcel Hoyer <m.hoyer@cid.com>
  • Loading branch information
mhoyer committed Feb 10, 2020
commit 455b0b75845ea73413295cfba2827f0b36c1443e
1 change: 1 addition & 0 deletions lib/git/lib.rb
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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