Skip to content

Commit dd8e8d4

Browse files
nevinerajcouball
authored andcommittedJun 1, 2024·
Supply all of the _specific_ color options too
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.
1 parent 749a72d commit dd8e8d4

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
 

‎lib/git/lib.rb

+8
Original file line numberDiff line numberDiff line change
@@ -1223,6 +1223,14 @@ def global_opts
12231223
global_opts << "--work-tree=#{@git_work_dir}" if !@git_work_dir.nil?
12241224
global_opts << '-c' << 'core.quotePath=true'
12251225
global_opts << '-c' << 'color.ui=false'
1226+
global_opts << '-c' << 'color.advice=false'
1227+
global_opts << '-c' << 'color.diff=false'
1228+
global_opts << '-c' << 'color.grep=false'
1229+
global_opts << '-c' << 'color.push=false'
1230+
global_opts << '-c' << 'color.remote=false'
1231+
global_opts << '-c' << 'color.showBranch=false'
1232+
global_opts << '-c' << 'color.status=false'
1233+
global_opts << '-c' << 'color.transport=false'
12261234
end
12271235
end
12281236

‎tests/files/working/dot_git/config

+9
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,12 @@
1313
[remote "working"]
1414
url = ../working.git
1515
fetch = +refs/heads/*:refs/remotes/working/*
16+
[color]
17+
diff = always
18+
showBranch = always
19+
grep = always
20+
advice = always
21+
push = always
22+
remote = always
23+
transport = always
24+
status = always

0 commit comments

Comments
 (0)