On Thursday, 18.05.2017 at 05:28 +0200, Francois Gouget wrote:
> Dear Maintainer,
>
> The README says that one can do:
>
> If you want to force disable colour escape sequences (for example
> pipe the output to patch), you can use option '--color=no' to do
> so:
>
> $ diff -u file1 file2 | colordiff --color=no | patch -p0 -d
> another-working-dir
>
>
> However in 1.0.16 this does not work bcause $color_patch is only used
> if output is to a file:
>
> if ((-f STDOUT) && ($color_patch == 0)) {
> ... disable color output ...
>
>
> So I propose the attached patch to make sure that *if set*
> $color_patch can override the automatic decisions either way.
>
> It would also make sense to ship a /etc/colordiffrc file where
> color_patches is set to auto, but whatever the case one would be able
> to get the desired behavior by using --color=XXX on the command line.[Back story: The 'color=no' behaviour was introduced to address the rather perverse (in my opinion) requirement of that command line above contributed by a user. As designed, the middle section of the pipe 'colordiff --color=no' serves *no purpose whatsoever* and should be omitted but someone required it in some odd corner case.] I accept that the documentation and the code don't match and that your patch sounds sensible. I'll either accept entirely as-is or, possibly, slightly modified. Given the primary purpose of colordiff is to add colour, in the case of any ambiguity, it will add colour rather than not. I agree that if one explicitly says 'color=no' it shouldn't add colour; even though this remains in my eyes and entirely pointless & unnecessary use of colordiff! Thanks Francois :-) Dave. -- Dave Ewart [email protected], http://twitter.com/DaveEwart All email from me is digitally signed, http://www.sungate.co.uk/ GPG key updated Jan 2013 see http://www.sungate.co.uk/gpg Fingerprint: CF3A 93EF 01E6 16C5 AE7A 1D27 45E1 E473 378B B197
signature.asc
Description: Digital signature

