threads / discuss / 30462

git -c var=val not taken into account by git config?

Subject: git -c var=val not taken into account by git config?

## tl;dr

3 messages between May 7, 2012 and May 8, 2012.

replies: 2people: 2as markdown or json

Daniel Villeneuve· May 7, 2012, 23:16 UTC · lore
Hi,
Testing color configuration via scripting, I tried the following command:
git -c color.diff=always config --get-colorbool diff false
on a repository with color.diff=auto.

I'd expect "true" as output, but got "false". "git diff" works as expected though. Is this an exception for "git config"?

Using git version 1.7.10.1. -- Daniel Villeneuve

Jeff King· May 8, 2012, 09:16 UTC · re: Daniel Villeneuve · lore

Re: git -c var=val not taken into account by git config?

On Mon, May 07, 2012 at 07:16:51PM -0400, Daniel Villeneuve wrote:
Show 8 quoted lines
> Testing color configuration via scripting, I tried the following command:
> 
> git -c color.diff=always config --get-colorbool diff false
> 
> on a repository with color.diff=auto.
> 
> I'd expect "true" as output, but got "false".  "git diff" works as
> expected though.  Is this an exception for "git config"?

I think you meant "--get-colorbool color.diff"; the fact that you are getting a colorbool does not automatically place the name inside the color.* section.

With that change, it seems to work as expected.
-Peff
Daniel Villeneuve· May 8, 2012, 12:56 UTC · re: Jeff King · lore

Re: git -c var=val not taken into account by git config?

On 08/05/12 05:16 AM, Jeff King wrote:
Show 18 quoted lines
> On Mon, May 07, 2012 at 07:16:51PM -0400, Daniel Villeneuve wrote:
>
>> Testing color configuration via scripting, I tried the following command:
>>
>> git -c color.diff=always config --get-colorbool diff false
>>
>> on a repository with color.diff=auto.
>>
>> I'd expect "true" as output, but got "false".  "git diff" works as
>> expected though.  Is this an exception for "git config"?
> I think you meant "--get-colorbool color.diff"; the fact that you are
> getting a colorbool does not automatically place the name inside the
> color.* section.
>
> With that change, it seems to work as expected.
>
> -Peff
>

Indeed, and the example was mentioning "color.diff". My error. Giving just "diff", I was getting results from color.ui instead.

Regards, -- Daniel

← back to recent threads