Junio C Hamano <gits...@pobox.com> writes: > Nguyễn Thái Ngọc Duy <pclo...@gmail.com> writes: > >> %C+ tells the next specifiers that color is preferred. %C- the >> opposite. So far only %H, %h and %d support coloring. >> >> Signed-off-by: Nguyễn Thái Ngọc Duy <pclo...@gmail.com> >> --- >> Documentation/pretty-formats.txt | 2 ++ >> pretty.c | 13 ++++++++++++- >> 2 files changed, 14 insertions(+), 1 deletion(-) >> >> diff --git a/Documentation/pretty-formats.txt >> b/Documentation/pretty-formats.txt >> index e3d8a83..6e287d6 100644 >> --- a/Documentation/pretty-formats.txt >> +++ b/Documentation/pretty-formats.txt >> @@ -142,6 +142,8 @@ The placeholders are: >> - '%Cblue': switch color to blue >> - '%Creset': reset color >> - '%C(...)': color specification, as described in color.branch.* config >> option >> +- '%C+': enable coloring on the following placeholders if supported >> +- '%C-': disable coloring on the following placeholders > > OK, so typically you replace some format placeholder "%?" in your > format string with "%C+%?%C-", because you cannot get away with > replacing it with "%C+%? and other things in the format you do not > know if they support coloring%C-". > > If that is the case, does it really make sense to have %C-? > > It smells as if it makes more sense to make _all_ %? placeholder > reset the effect of %C+ after they are done (even the ones that they > themselves do not color their own output elements), so that you can > mechanically replace "%?" with "%C+%?". > > I dunno.
Thinking about this a bit more, perhaps we would want a generic mechanism to give parameters to various %? placeholders. This is not limited to "I can do color but there is no mechanism for the user to tell me that I should do color" %H, %h and %d may want to say. An obvious and immediate example is that %h might want to be told how many hexdigits it should use. -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html