{"thread":{"id":"17760","subject":"[PATCH] Clean up use of ANSI color sequences","startedAt":"2009-02-12T20:37:39Z","lastAt":"2009-02-14T07:53:24Z","messageCount":7,"participants":["Arjen Laarhoven","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"104413","messageId":"1234471059-53625-1-git-send-email-arjen@yaph.org","threadId":"17760","inReplyTo":null,"subject":"[PATCH] Clean up use of ANSI color sequences","fromName":"Arjen Laarhoven","fromEmail":"arjen@yaph.org","sentAt":"2009-02-12T20:37:39Z","receivedAt":"2009-02-12T20:37:39Z","isPatch":true,"sender":{"key":"arjen@yaph.org","avatar":"https://gravatar.com/avatar/f776c2c0c5ea62d70827b942eb7d95ce85661a3d70bc3f03cf9773815c599c01?d=mp&s=160"},"body":"Remove the literal ANSI escape sequences and replace them by readable\nconstants.\n\nSigned-off-by: Arjen Laarhoven <arjen@yaph.org>\n---\n builtin-branch.c |   10 +++++-----\n color.c          |    4 +---\n color.h          |   10 ++++++++++\n diff.c           |   16 ++++++++--------\n pretty.c         |    8 ++++----\n wt-status.c      |   10 +++++-----\n 6 files changed, 33 insertions(+), 25 deletions(-)\n\ndiff --git a/builtin-branch.c b/builtin-branch.c\nindex 56a1971..c154500 100644\n--- a/builtin-branch.c\n+++ b/builtin-branch.c\n@@ -32,11 +32,11 @@ static unsigned char head_sha1[20];\n \n static int branch_use_color = -1;\n static char branch_colors[][COLOR_MAXLEN] = {\n-\t\"\\033[m\",\t/* reset */\n-\t\"\",\t\t/* PLAIN (normal) */\n-\t\"\\033[31m\",\t/* REMOTE (red) */\n-\t\"\",\t\t/* LOCAL (normal) */\n-\t\"\\033[32m\",\t/* CURRENT (green) */\n+\tCOLOR_RESET,\n+\tCOLOR_NORMAL,\t/* PLAIN */\n+\tCOLOR_RED,\t/* REMOTE */\n+\tCOLOR_NORMAL,\t/* LOCAL */\n+\tCOLOR_GREEN,\t/* CURRENT */\n };\n enum color_branch {\n \tCOLOR_BRANCH_RESET = 0,\ndiff --git a/color.c b/color.c\nindex db4dccf..5653667 100644\n--- a/color.c\n+++ b/color.c\n@@ -1,8 +1,6 @@\n #include \"cache.h\"\n #include \"color.h\"\n \n-#define COLOR_RESET \"\\033[m\"\n-\n int git_use_color_default = 0;\n \n static int parse_color(const char *name, int len)\n@@ -54,7 +52,7 @@ void color_parse_mem(const char *value, int value_len, const char *var,\n \tint bg = -2;\n \n \tif (!strncasecmp(value, \"reset\", len)) {\n-\t\tstrcpy(dst, \"\\033[m\");\n+\t\tstrcpy(dst, COLOR_RESET);\n \t\treturn;\n \t}\n \ndiff --git a/color.h b/color.h\nindex 5019df8..c4d2e53 100644\n--- a/color.h\n+++ b/color.h\n@@ -4,6 +4,16 @@\n /* \"\\033[1;38;5;2xx;48;5;2xxm\\0\" is 23 bytes */\n #define COLOR_MAXLEN 24\n \n+#define COLOR_NORMAL\t\"\"\n+#define COLOR_RESET\t\"\\033[m\"\n+#define COLOR_BOLD\t\"\\033[1m\"\n+#define COLOR_RED\t\"\\033[31m\"\n+#define COLOR_GREEN\t\"\\033[32m\"\n+#define COLOR_YELLOW\t\"\\033[33m\"\n+#define COLOR_BLUE\t\"\\033[34m\"\n+#define COLOR_CYAN\t\"\\033[36m\"\n+#define COLOR_BG_RED\t\"\\033[41m\"\n+\n /*\n  * This variable stores the value of color.ui\n  */\ndiff --git a/diff.c b/diff.c\nindex a5a540f..1ca64d3 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -30,14 +30,14 @@ int diff_auto_refresh_index = 1;\n static int diff_mnemonic_prefix;\n \n static char diff_colors[][COLOR_MAXLEN] = {\n-\t\"\\033[m\",\t/* reset */\n-\t\"\",\t\t/* PLAIN (normal) */\n-\t\"\\033[1m\",\t/* METAINFO (bold) */\n-\t\"\\033[36m\",\t/* FRAGINFO (cyan) */\n-\t\"\\033[31m\",\t/* OLD (red) */\n-\t\"\\033[32m\",\t/* NEW (green) */\n-\t\"\\033[33m\",\t/* COMMIT (yellow) */\n-\t\"\\033[41m\",\t/* WHITESPACE (red background) */\n+\tCOLOR_RESET,\n+\tCOLOR_NORMAL,\t/* PLAIN */\n+\tCOLOR_BOLD,\t/* METAINFO */\n+\tCOLOR_CYAN,\t/* FRAGINFO */\n+\tCOLOR_RED,\t/* OLD */\n+\tCOLOR_GREEN,\t/* NEW */\n+\tCOLOR_YELLOW,\t/* COMMIT */\n+\tCOLOR_BG_RED,\t/* WHITESPACE */\n };\n \n static void diff_filespec_load_driver(struct diff_filespec *one);\ndiff --git a/pretty.c b/pretty.c\nindex cc460b5..a8595f6 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -567,16 +567,16 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder,\n \t\t\treturn end - placeholder + 1;\n \t\t}\n \t\tif (!prefixcmp(placeholder + 1, \"red\")) {\n-\t\t\tstrbuf_addstr(sb, \"\\033[31m\");\n+\t\t\tstrbuf_addstr(sb, COLOR_RED);\n \t\t\treturn 4;\n \t\t} else if (!prefixcmp(placeholder + 1, \"green\")) {\n-\t\t\tstrbuf_addstr(sb, \"\\033[32m\");\n+\t\t\tstrbuf_addstr(sb, COLOR_GREEN);\n \t\t\treturn 6;\n \t\t} else if (!prefixcmp(placeholder + 1, \"blue\")) {\n-\t\t\tstrbuf_addstr(sb, \"\\033[34m\");\n+\t\t\tstrbuf_addstr(sb, COLOR_BLUE);\n \t\t\treturn 5;\n \t\t} else if (!prefixcmp(placeholder + 1, \"reset\")) {\n-\t\t\tstrbuf_addstr(sb, \"\\033[m\");\n+\t\t\tstrbuf_addstr(sb, COLOR_RESET);\n \t\t\treturn 6;\n \t\t} else\n \t\t\treturn 0;\ndiff --git a/wt-status.c b/wt-status.c\nindex 96ff2f8..432d23a 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -15,11 +15,11 @@ int wt_status_relative_paths = 1;\n int wt_status_use_color = -1;\n int wt_status_submodule_summary;\n static char wt_status_colors[][COLOR_MAXLEN] = {\n-\t\"\",         /* WT_STATUS_HEADER: normal */\n-\t\"\\033[32m\", /* WT_STATUS_UPDATED: green */\n-\t\"\\033[31m\", /* WT_STATUS_CHANGED: red */\n-\t\"\\033[31m\", /* WT_STATUS_UNTRACKED: red */\n-\t\"\\033[31m\", /* WT_STATUS_NOBRANCH: red */\n+\tCOLOR_NORMAL, /* WT_STATUS_HEADER */\n+\tCOLOR_GREEN,  /* WT_STATUS_UPDATED */\n+\tCOLOR_RED,    /* WT_STATUS_CHANGED */\n+\tCOLOR_RED,    /* WT_STATUS_UNTRACKED */\n+\tCOLOR_RED,    /* WT_STATUS_NOBRANCH */\n };\n \n enum untracked_status_type show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;\n-- \n1.6.2.rc0.186.g417c\n"},{"id":"104444","messageId":"7vy6wbi7gm.fsf@gitster.siamese.dyndns.org","threadId":"17760","inReplyTo":"1234471059-53625-1-git-send-email-arjen@yaph.org","subject":"Re: [PATCH] Clean up use of ANSI color sequences","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-12T23:03:21Z","receivedAt":"2009-02-12T23:03:21Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Arjen Laarhoven <arjen@yaph.org> writes:\n\n> diff --git a/color.h b/color.h\n> index 5019df8..c4d2e53 100644\n> --- a/color.h\n> +++ b/color.h\n> @@ -4,6 +4,16 @@\n>  /* \"\\033[1;38;5;2xx;48;5;2xxm\\0\" is 23 bytes */\n>  #define COLOR_MAXLEN 24\n>  \n> +#define COLOR_NORMAL\t\"\"\n> +#define COLOR_RESET\t\"\\033[m\"\n> +#define COLOR_BOLD\t\"\\033[1m\"\n> +#define COLOR_RED\t\"\\033[31m\"\n> +#define COLOR_GREEN\t\"\\033[32m\"\n> +#define COLOR_YELLOW\t\"\\033[33m\"\n> +#define COLOR_BLUE\t\"\\033[34m\"\n> +#define COLOR_CYAN\t\"\\033[36m\"\n> +#define COLOR_BG_RED\t\"\\033[41m\"\n\nSounds like a very sane thing to do in principle, but the choice of\nconstant names are problematic.\n\n (1) There are COLOR_BRANCH_$category constants, that look very similar\n     (they probably should be renamed to BRANCH_COLOR_$category). \n\n (2) These are ANSI constants so it might be better to call them\n     ANSI_COLOR_$physical_attributes, or GIT_COLOR_$physical_attributes.\n\n     I actually prefer the latter because then later we can potentially\n     redefine these macros with something like:\n\n\t#define GIT_COLOR_RED ti_setf(COLOR_RED)\n\t#define GIT_COLOR_BG_RED ti_setb(COLOR_RED)\n\n     and write a set of small wrappers to terminfo to support non ANSI\n     terminals without changing the rest of the code.  It is nicer to use\n     GIT_COLOR_RED instead of COLOR_RED, because the latter are defined in\n     ncurses.h like this:\n\n        /* colors */\n        #define COLOR_BLACK\t0\n        #define COLOR_RED\t1\n        #define COLOR_GREEN\t2\n        #define COLOR_YELLOW\t3\n        #define COLOR_BLUE\t4\n        #define COLOR_MAGENTA\t5\n        #define COLOR_CYAN\t6\n        #define COLOR_WHITE\t7\n"},{"id":"104544","messageId":"1234562021-2397-1-git-send-email-arjen@yaph.org","threadId":"17760","inReplyTo":"7vy6wbi7gm.fsf@gitster.siamese.dyndns.org","subject":"[PATCH 1/2] Clean up use of ANSI color sequences","fromName":"Arjen Laarhoven","fromEmail":"arjen@yaph.org","sentAt":"2009-02-13T21:53:40Z","receivedAt":"2009-02-13T21:53:40Z","isPatch":true,"sender":{"key":"arjen@yaph.org","avatar":"https://gravatar.com/avatar/f776c2c0c5ea62d70827b942eb7d95ce85661a3d70bc3f03cf9773815c599c01?d=mp&s=160"},"body":"Remove the literal ANSI escape sequences and replace them by readable\nconstants.\n\nSigned-off-by: Arjen Laarhoven <arjen@yaph.org>\n---\n builtin-branch.c |   10 +++++-----\n color.c          |    8 +++-----\n color.h          |   10 ++++++++++\n diff.c           |   16 ++++++++--------\n pretty.c         |    8 ++++----\n wt-status.c      |   10 +++++-----\n 6 files changed, 35 insertions(+), 27 deletions(-)\n\ndiff --git a/builtin-branch.c b/builtin-branch.c\nindex 56a1971..fe139e1 100644\n--- a/builtin-branch.c\n+++ b/builtin-branch.c\n@@ -32,11 +32,11 @@ static unsigned char head_sha1[20];\n \n static int branch_use_color = -1;\n static char branch_colors[][COLOR_MAXLEN] = {\n-\t\"\\033[m\",\t/* reset */\n-\t\"\",\t\t/* PLAIN (normal) */\n-\t\"\\033[31m\",\t/* REMOTE (red) */\n-\t\"\",\t\t/* LOCAL (normal) */\n-\t\"\\033[32m\",\t/* CURRENT (green) */\n+\tGIT_COLOR_RESET,\n+\tGIT_COLOR_NORMAL,\t/* PLAIN */\n+\tGIT_COLOR_RED,\t\t/* REMOTE */\n+\tGIT_COLOR_NORMAL,\t/* LOCAL */\n+\tGIT_COLOR_GREEN,\t/* CURRENT */\n };\n enum color_branch {\n \tCOLOR_BRANCH_RESET = 0,\ndiff --git a/color.c b/color.c\nindex db4dccf..62977f4 100644\n--- a/color.c\n+++ b/color.c\n@@ -1,8 +1,6 @@\n #include \"cache.h\"\n #include \"color.h\"\n \n-#define COLOR_RESET \"\\033[m\"\n-\n int git_use_color_default = 0;\n \n static int parse_color(const char *name, int len)\n@@ -54,7 +52,7 @@ void color_parse_mem(const char *value, int value_len, const char *var,\n \tint bg = -2;\n \n \tif (!strncasecmp(value, \"reset\", len)) {\n-\t\tstrcpy(dst, \"\\033[m\");\n+\t\tstrcpy(dst, GIT_COLOR_RESET);\n \t\treturn;\n \t}\n \n@@ -175,7 +173,7 @@ static int color_vfprintf(FILE *fp, const char *color, const char *fmt,\n \t\tr += fprintf(fp, \"%s\", color);\n \tr += vfprintf(fp, fmt, args);\n \tif (*color)\n-\t\tr += fprintf(fp, \"%s\", COLOR_RESET);\n+\t\tr += fprintf(fp, \"%s\", GIT_COLOR_RESET);\n \tif (trail)\n \t\tr += fprintf(fp, \"%s\", trail);\n \treturn r;\n@@ -217,7 +215,7 @@ int color_fwrite_lines(FILE *fp, const char *color,\n \t\tchar *p = memchr(buf, '\\n', count);\n \t\tif (p != buf && (fputs(color, fp) < 0 ||\n \t\t\t\tfwrite(buf, p ? p - buf : count, 1, fp) != 1 ||\n-\t\t\t\tfputs(COLOR_RESET, fp) < 0))\n+\t\t\t\tfputs(GIT_COLOR_RESET, fp) < 0))\n \t\t\treturn -1;\n \t\tif (!p)\n \t\t\treturn 0;\ndiff --git a/color.h b/color.h\nindex 5019df8..6846be1 100644\n--- a/color.h\n+++ b/color.h\n@@ -4,6 +4,16 @@\n /* \"\\033[1;38;5;2xx;48;5;2xxm\\0\" is 23 bytes */\n #define COLOR_MAXLEN 24\n \n+#define GIT_COLOR_NORMAL\t\"\"\n+#define GIT_COLOR_RESET\t\t\"\\033[m\"\n+#define GIT_COLOR_BOLD\t\t\"\\033[1m\"\n+#define GIT_COLOR_RED\t\t\"\\033[31m\"\n+#define GIT_COLOR_GREEN\t\t\"\\033[32m\"\n+#define GIT_COLOR_YELLOW\t\"\\033[33m\"\n+#define GIT_COLOR_BLUE\t\t\"\\033[34m\"\n+#define GIT_COLOR_CYAN\t\t\"\\033[36m\"\n+#define GIT_COLOR_BG_RED\t\"\\033[41m\"\n+\n /*\n  * This variable stores the value of color.ui\n  */\ndiff --git a/diff.c b/diff.c\nindex a5a540f..2513a54 100644\n--- a/diff.c\n+++ b/diff.c\n@@ -30,14 +30,14 @@ int diff_auto_refresh_index = 1;\n static int diff_mnemonic_prefix;\n \n static char diff_colors[][COLOR_MAXLEN] = {\n-\t\"\\033[m\",\t/* reset */\n-\t\"\",\t\t/* PLAIN (normal) */\n-\t\"\\033[1m\",\t/* METAINFO (bold) */\n-\t\"\\033[36m\",\t/* FRAGINFO (cyan) */\n-\t\"\\033[31m\",\t/* OLD (red) */\n-\t\"\\033[32m\",\t/* NEW (green) */\n-\t\"\\033[33m\",\t/* COMMIT (yellow) */\n-\t\"\\033[41m\",\t/* WHITESPACE (red background) */\n+\tGIT_COLOR_RESET,\n+\tGIT_COLOR_NORMAL,\t/* PLAIN */\n+\tGIT_COLOR_BOLD,\t\t/* METAINFO */\n+\tGIT_COLOR_CYAN,\t\t/* FRAGINFO */\n+\tGIT_COLOR_RED,\t\t/* OLD */\n+\tGIT_COLOR_GREEN,\t/* NEW */\n+\tGIT_COLOR_YELLOW,\t/* COMMIT */\n+\tGIT_COLOR_BG_RED,\t/* WHITESPACE */\n };\n \n static void diff_filespec_load_driver(struct diff_filespec *one);\ndiff --git a/pretty.c b/pretty.c\nindex cc460b5..a8595f6 100644\n--- a/pretty.c\n+++ b/pretty.c\n@@ -567,16 +567,16 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder,\n \t\t\treturn end - placeholder + 1;\n \t\t}\n \t\tif (!prefixcmp(placeholder + 1, \"red\")) {\n-\t\t\tstrbuf_addstr(sb, \"\\033[31m\");\n+\t\t\tstrbuf_addstr(sb, COLOR_RED);\n \t\t\treturn 4;\n \t\t} else if (!prefixcmp(placeholder + 1, \"green\")) {\n-\t\t\tstrbuf_addstr(sb, \"\\033[32m\");\n+\t\t\tstrbuf_addstr(sb, COLOR_GREEN);\n \t\t\treturn 6;\n \t\t} else if (!prefixcmp(placeholder + 1, \"blue\")) {\n-\t\t\tstrbuf_addstr(sb, \"\\033[34m\");\n+\t\t\tstrbuf_addstr(sb, COLOR_BLUE);\n \t\t\treturn 5;\n \t\t} else if (!prefixcmp(placeholder + 1, \"reset\")) {\n-\t\t\tstrbuf_addstr(sb, \"\\033[m\");\n+\t\t\tstrbuf_addstr(sb, COLOR_RESET);\n \t\t\treturn 6;\n \t\t} else\n \t\t\treturn 0;\ndiff --git a/wt-status.c b/wt-status.c\nindex 96ff2f8..dd87339 100644\n--- a/wt-status.c\n+++ b/wt-status.c\n@@ -15,11 +15,11 @@ int wt_status_relative_paths = 1;\n int wt_status_use_color = -1;\n int wt_status_submodule_summary;\n static char wt_status_colors[][COLOR_MAXLEN] = {\n-\t\"\",         /* WT_STATUS_HEADER: normal */\n-\t\"\\033[32m\", /* WT_STATUS_UPDATED: green */\n-\t\"\\033[31m\", /* WT_STATUS_CHANGED: red */\n-\t\"\\033[31m\", /* WT_STATUS_UNTRACKED: red */\n-\t\"\\033[31m\", /* WT_STATUS_NOBRANCH: red */\n+\tGIT_COLOR_NORMAL, /* WT_STATUS_HEADER */\n+\tGIT_COLOR_GREEN,  /* WT_STATUS_UPDATED */\n+\tGIT_COLOR_RED,    /* WT_STATUS_CHANGED */\n+\tGIT_COLOR_RED,    /* WT_STATUS_UNTRACKED */\n+\tGIT_COLOR_RED,    /* WT_STATUS_NOBRANCH */\n };\n \n enum untracked_status_type show_untracked_files = SHOW_NORMAL_UNTRACKED_FILES;\n-- \n1.6.2.rc0.186.g417c\n"},{"id":"104545","messageId":"1234562021-2397-2-git-send-email-arjen@yaph.org","threadId":"17760","inReplyTo":"1234562021-2397-1-git-send-email-arjen@yaph.org","subject":"[PATCH 2/2] builtin-branch.c: Rename branch category color names","fromName":"Arjen Laarhoven","fromEmail":"arjen@yaph.org","sentAt":"2009-02-13T21:53:41Z","receivedAt":"2009-02-13T21:53:41Z","isPatch":true,"sender":{"key":"arjen@yaph.org","avatar":"https://gravatar.com/avatar/f776c2c0c5ea62d70827b942eb7d95ce85661a3d70bc3f03cf9773815c599c01?d=mp&s=160"},"body":"The branch color constants have the form COLOR_BRANCH_$category.  Rename\nthem to BRANCH_COLOR_$category as this conveys their meaning better.\n\nSigned-off-by: Arjen Laarhoven <arjen@yaph.org>\n---\n builtin-branch.c |   32 ++++++++++++++++----------------\n 1 files changed, 16 insertions(+), 16 deletions(-)\n\ndiff --git a/builtin-branch.c b/builtin-branch.c\nindex fe139e1..6d241c8 100644\n--- a/builtin-branch.c\n+++ b/builtin-branch.c\n@@ -39,11 +39,11 @@ static char branch_colors[][COLOR_MAXLEN] = {\n \tGIT_COLOR_GREEN,\t/* CURRENT */\n };\n enum color_branch {\n-\tCOLOR_BRANCH_RESET = 0,\n-\tCOLOR_BRANCH_PLAIN = 1,\n-\tCOLOR_BRANCH_REMOTE = 2,\n-\tCOLOR_BRANCH_LOCAL = 3,\n-\tCOLOR_BRANCH_CURRENT = 4,\n+\tBRANCH_COLOR_RESET = 0,\n+\tBRANCH_COLOR_PLAIN = 1,\n+\tBRANCH_COLOR_REMOTE = 2,\n+\tBRANCH_COLOR_LOCAL = 3,\n+\tBRANCH_COLOR_CURRENT = 4,\n };\n \n static enum merge_filter {\n@@ -56,15 +56,15 @@ static unsigned char merge_filter_ref[20];\n static int parse_branch_color_slot(const char *var, int ofs)\n {\n \tif (!strcasecmp(var+ofs, \"plain\"))\n-\t\treturn COLOR_BRANCH_PLAIN;\n+\t\treturn BRANCH_COLOR_PLAIN;\n \tif (!strcasecmp(var+ofs, \"reset\"))\n-\t\treturn COLOR_BRANCH_RESET;\n+\t\treturn BRANCH_COLOR_RESET;\n \tif (!strcasecmp(var+ofs, \"remote\"))\n-\t\treturn COLOR_BRANCH_REMOTE;\n+\t\treturn BRANCH_COLOR_REMOTE;\n \tif (!strcasecmp(var+ofs, \"local\"))\n-\t\treturn COLOR_BRANCH_LOCAL;\n+\t\treturn BRANCH_COLOR_LOCAL;\n \tif (!strcasecmp(var+ofs, \"current\"))\n-\t\treturn COLOR_BRANCH_CURRENT;\n+\t\treturn BRANCH_COLOR_CURRENT;\n \tdie(\"bad config variable '%s'\", var);\n }\n \n@@ -303,20 +303,20 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,\n \n \tswitch (item->kind) {\n \tcase REF_LOCAL_BRANCH:\n-\t\tcolor = COLOR_BRANCH_LOCAL;\n+\t\tcolor = BRANCH_COLOR_LOCAL;\n \t\tbreak;\n \tcase REF_REMOTE_BRANCH:\n-\t\tcolor = COLOR_BRANCH_REMOTE;\n+\t\tcolor = BRANCH_COLOR_REMOTE;\n \t\tbreak;\n \tdefault:\n-\t\tcolor = COLOR_BRANCH_PLAIN;\n+\t\tcolor = BRANCH_COLOR_PLAIN;\n \t\tbreak;\n \t}\n \n \tc = ' ';\n \tif (current) {\n \t\tc = '*';\n-\t\tcolor = COLOR_BRANCH_CURRENT;\n+\t\tcolor = BRANCH_COLOR_CURRENT;\n \t}\n \n \tif (verbose) {\n@@ -335,14 +335,14 @@ static void print_ref_item(struct ref_item *item, int maxwidth, int verbose,\n \n \t\tprintf(\"%c %s%-*s%s %s %s%s\\n\", c, branch_get_color(color),\n \t\t       maxwidth, item->name,\n-\t\t       branch_get_color(COLOR_BRANCH_RESET),\n+\t\t       branch_get_color(BRANCH_COLOR_RESET),\n \t\t       find_unique_abbrev(item->commit->object.sha1, abbrev),\n \t\t       stat.buf, sub);\n \t\tstrbuf_release(&stat);\n \t\tstrbuf_release(&subject);\n \t} else {\n \t\tprintf(\"%c %s%s%s\\n\", c, branch_get_color(color), item->name,\n-\t\t       branch_get_color(COLOR_BRANCH_RESET));\n+\t\t       branch_get_color(BRANCH_COLOR_RESET));\n \t}\n }\n \n-- \n1.6.2.rc0.186.g417c\n"},{"id":"104566","messageId":"7v4oyx4vxw.fsf@gitster.siamese.dyndns.org","threadId":"17760","inReplyTo":"1234562021-2397-1-git-send-email-arjen@yaph.org","subject":"Re: [PATCH 1/2] Clean up use of ANSI color sequences","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-14T02:02:51Z","receivedAt":"2009-02-14T02:02:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Arjen Laarhoven <arjen@yaph.org> writes:\n\n> diff --git a/pretty.c b/pretty.c\n> index cc460b5..a8595f6 100644\n> --- a/pretty.c\n> +++ b/pretty.c\n> @@ -567,16 +567,16 @@ static size_t format_commit_item(struct strbuf *sb, const char *placeholder,\n>  \t\t\treturn end - placeholder + 1;\n>  \t\t}\n>  \t\tif (!prefixcmp(placeholder + 1, \"red\")) {\n> -\t\t\tstrbuf_addstr(sb, \"\\033[31m\");\n> +\t\t\tstrbuf_addstr(sb, COLOR_RED);\n>  \t\t\treturn 4;\n>  \t\t} else if (!prefixcmp(placeholder + 1, \"green\")) {\n> -\t\t\tstrbuf_addstr(sb, \"\\033[32m\");\n> +\t\t\tstrbuf_addstr(sb, COLOR_GREEN);\n>  \t\t\treturn 6;\n>  \t\t} else if (!prefixcmp(placeholder + 1, \"blue\")) {\n> -\t\t\tstrbuf_addstr(sb, \"\\033[34m\");\n> +\t\t\tstrbuf_addstr(sb, COLOR_BLUE);\n>  \t\t\treturn 5;\n>  \t\t} else if (!prefixcmp(placeholder + 1, \"reset\")) {\n> -\t\t\tstrbuf_addstr(sb, \"\\033[m\");\n> +\t\t\tstrbuf_addstr(sb, COLOR_RESET);\n\nThese four are obviously bad and not even compile tested.\n\nI'll fix them up when queuing.\n"},{"id":"104609","messageId":"20090214074134.GC10795@regex.yaph.org","threadId":"17760","inReplyTo":"7v4oyx4vxw.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH 1/2] Clean up use of ANSI color sequences","fromName":"Arjen Laarhoven","fromEmail":"arjen@yaph.org","sentAt":"2009-02-14T07:41:34Z","receivedAt":"2009-02-14T07:41:34Z","isPatch":true,"sender":{"key":"arjen@yaph.org","avatar":"https://gravatar.com/avatar/f776c2c0c5ea62d70827b942eb7d95ce85661a3d70bc3f03cf9773815c599c01?d=mp&s=160"},"body":"On Fri, Feb 13, 2009 at 06:02:51PM -0800, Junio C Hamano wrote:\n\n[...]\n\n> These four are obviously bad and not even compile tested.\n> \n> I'll fix them up when queuing.\n\nGrmbl.  Note to self: never patch and watch TV.  Sorry about this.\n\n-- \nArjen Laarhoven\n\nThe presence of those seeking the truth is infinitely to be preferred to \nthose who think they've found it.\n                                -- Terry Pratchett, \"Monstrous Regiment\"\n"},{"id":"104610","messageId":"7vocx5xxmz.fsf@gitster.siamese.dyndns.org","threadId":"17760","inReplyTo":"20090214074134.GC10795@regex.yaph.org","subject":"Re: [PATCH 1/2] Clean up use of ANSI color sequences","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-02-14T07:53:24Z","receivedAt":"2009-02-14T07:53:24Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"arjen@yaph.org (Arjen Laarhoven) writes:\n\n> On Fri, Feb 13, 2009 at 06:02:51PM -0800, Junio C Hamano wrote:\n>\n> [...]\n>\n>> These four are obviously bad and not even compile tested.\n>> \n>> I'll fix them up when queuing.\n>\n> Grmbl.  Note to self: never patch and watch TV.  Sorry about this.\n\nThat's Ok, mistakes happen.  And I sometimes watch TV while my machine is\ndoing all the work for me ;-)\n"}]}