Skip to content

Commit

Permalink
Supply all of the _specific_ color options too
Browse files Browse the repository at this point in the history
Previously, we were supplying `color.ui=false`, but if the local
gitconfig specified any of the more specific options (like
`color.diff`), those would take precedence. This updates our
command-runner to always supply all of the specific color options as
false as well, so that we definitely get a color-free output suitable
for parsing.
  • Loading branch information
nevinera authored and jcouball committed Jun 1, 2024
1 parent 749a72d commit dd8e8d4
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 0 deletions.
8 changes: 8 additions & 0 deletions lib/git/lib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1223,6 +1223,14 @@ def global_opts
global_opts << "--work-tree=#{@git_work_dir}" if !@git_work_dir.nil?
global_opts << '-c' << 'core.quotePath=true'
global_opts << '-c' << 'color.ui=false'
global_opts << '-c' << 'color.advice=false'
global_opts << '-c' << 'color.diff=false'
global_opts << '-c' << 'color.grep=false'
global_opts << '-c' << 'color.push=false'
global_opts << '-c' << 'color.remote=false'
global_opts << '-c' << 'color.showBranch=false'
global_opts << '-c' << 'color.status=false'
global_opts << '-c' << 'color.transport=false'
end
end

Expand Down
9 changes: 9 additions & 0 deletions tests/files/working/dot_git/config
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,12 @@
[remote "working"]
url = ../working.git
fetch = +refs/heads/*:refs/remotes/working/*
[color]
diff = always
showBranch = always
grep = always
advice = always
push = always
remote = always
transport = always
status = always

0 comments on commit dd8e8d4

Please sign in to comment.