Re: [PATCH v5 08/14] builtin/config: introduce "get" subcommand

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



SZEDER Gábor <szeder.dev@xxxxxxxxx> writes:

>>  #!/bin/sh
>> -WS=$(git config --get-color color.diff.whitespace "blue reverse")
>> -RESET=$(git config --get-color "" "reset")
>> +WS=$(git config get --type=color --default="blue reverse" color.diff.whitespace)
>> +RESET=$(git config get --type=color --default="reset" "")
>>  echo "${WS}your whitespace color or blue reverse${RESET}"
>
> In this example the second command in the postimage doesn't work:
>
>   $ RESET=$(git config get --type=color --default="reset" "")
>   error: key does not contain a section: 
>
> Consequently, the last command doesn't work as expected anymore,
> because the color is not reset at the end of the output.
>
> Luckily, the commands in the preimage still work.

Instead of an empty string as a configuration variable, using
something like no.such.variable that does not exist would also be
a workaround.  I.e.,

  RESET=$(git config get --type=color --default=reset no.such.variable)

What is bad about this is that there is no generic variable that is
guaranteed to be unset.





[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux