git diff-index ignores color config

From: Elias Persson <hidden>
Date: 2016-06-15 22:51:05

Having color.ui (and/or color.diff) set to auto, doing

   git diff-index --check <some refspec>

on a set with e.g. trailing whitespace does not produce colored
output.

If providing the option on the command line, e.g.

   git diff-index --check --color=auto <some refspec>

output _is_ colored, so obviously not an issue with tty
detection. Doesn't work when configured to 'true' either.


Documentation indicates that the config option is considered
(see under --no-color), so to me it seems like there's a bug
here, somewhere.


Most likely way of coming across this issue would be turning on
the shipped pre-commit hook sample, at least that's how I found
it. It ends (and does most of its work) with

    exec git diff-index --check --cached $against --

where $against is normally HEAD.


git --version: 1.7.4.4
uname -srio: Linux 2.6.35.12-88.fc14.i686 i386 GNU/Linux


// Delreich
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help