If color.diff is set then patches not yet cherry-picked are marked green and already picked ones are marked red. This makes it easier to tell at a glance which changes have not been cherry-picked. A possible inconsistency is that the sha1 is marked in red or green here whereas it is yellow elsewhere. The other possibility was to mark only the +/- sign in the appropriate color, but this was more difficult to distinguish between not-picked/picked changes. Signed-off-by: Richard Quirk <richard.quirk@xxxxxxxxx> --- builtin-log.c | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/builtin-log.c b/builtin-log.c index 1670d0b..bca6dd7 100644 --- a/builtin-log.c +++ b/builtin-log.c @@ -1083,6 +1083,11 @@ int cmd_cherry(int argc, const char **argv, const char *prefix) const char *limit = NULL; int verbose = 0; + git_config(git_log_config); + + if (diff_use_color_default == -1) + diff_use_color_default = git_use_color_default; + if (argc > 1 && !strcmp(argv[1], "-v")) { verbose = 1; argc--; @@ -1136,26 +1141,32 @@ int cmd_cherry(int argc, const char **argv, const char *prefix) commit_list_insert(commit, &list); } + const char *reset = diff_get_color(diff_use_color_default, DIFF_RESET); + const char *old = diff_get_color(diff_use_color_default, DIFF_FILE_OLD); + const char *new = diff_get_color(diff_use_color_default, DIFF_FILE_NEW); while (list) { char sign = '+'; + const char * line_color = new; commit = list->item; - if (has_commit_patch_id(commit, &ids)) + if (has_commit_patch_id(commit, &ids)) { sign = '-'; + line_color = old; + } + printf("%s%c %s%s", line_color, sign, + sha1_to_hex(commit->object.sha1), reset); if (verbose) { struct strbuf buf; strbuf_init(&buf, 0); pretty_print_commit(CMIT_FMT_ONELINE, commit, &buf, 0, NULL, NULL, 0, 0); - printf("%c %s %s\n", sign, - sha1_to_hex(commit->object.sha1), buf.buf); + printf(" %s\n", buf.buf); strbuf_release(&buf); } else { - printf("%c %s\n", sign, - sha1_to_hex(commit->object.sha1)); + printf("\n"); } list = list->next; -- 1.5.5.1.116.ge4b9c -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html