[BUG] Some subcommands ignore color.diff and color.ui in --patch mode

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

 



Bassically the colouring behaviour of the interactive --patch option to the various commands differ.
I'll call "commit, add, and stash the "good commands" (as they behave as I expect), and stash push, stash save, checkout, reset, and restore the "bad commands" (which are bugged).

I assume you have git v2.50.1, a dirty working tree, and no colour related settings in any of the config files, and where $CMD is the name of any "bad command".

The following all print in colour (I expect no colour):
    git -c color.diff=never        $CMD --patch .
    git -c color.ui=never          $CMD --patch .

The folowing do not print anything in colour (I expect it to work the same as without the cat):
    git -c color.diff=always        $CMD --patch . | cat
    git -c color.ui=always          $CMD --patch . | cat

Now the documenation for color.interactive says:
    When set to always, always use colors for interactive prompts and displays (such as those used by "git-add --interactive" and
    "git-clean --interactive"). When false (or never), never. When set to true or auto, use colors only when the output is to the
    terminal. If unset, then the value of color.ui is used (auto by default).

Now the bad commands are respecting the setting of color.interactive corroectly (and the same as the good commands).
For example, this always prints a coloured prompt (but not a coloured diff)
    git -c color.interactive=always          $CMD --patch . | cat

But as mentioned above, "color.ui=always" will NOT print the prompt in color.

As for why I care, I was trying to pipe git restore through diff-highlight (this functionality should really be inbuilt into git diff)

A related issue, that is probably not a 'bug': all the --patch options ignore the diff config options (e.g. diff.wordRegex).

— Isaac Oscar Gariano​




[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