for-each-ref: avoid color leakage
To make sure that an invocation like the following doesn't leak color, $ git for-each-ref --format='%(subject)%(color:green)' auto-reset at the end of the format string when the last color token seen in the format string isn't a color-reset. Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
fddb74c947
commit
db64eb655b
@ -356,7 +356,7 @@ $(git rev-parse --short refs/tags/two) $(get_color green)two$(get_color reset)
|
||||
EOF
|
||||
|
||||
test_expect_success 'Check %(color:...) ' '
|
||||
git for-each-ref --format="%(objectname:short) %(color:green)%(refname:short)%(color:reset)" >actual &&
|
||||
git for-each-ref --format="%(objectname:short) %(color:green)%(refname:short)" >actual &&
|
||||
test_cmp expected actual
|
||||
'
|
||||
|
||||
|
Reference in New Issue
Block a user