Merge branch 'js/color-on-windows-comment'
authorJunio C Hamano <gitster@pobox.com>
Mon, 11 Jul 2016 17:31:09 +0000 (10:31 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 11 Jul 2016 17:31:09 +0000 (10:31 -0700)
For a long time, we carried an in-code comment that said our
colored output would work only when we use fprintf/fputs on
Windows, which no longer is the case for the past few years.

* js/color-on-windows-comment:
color.h: remove obsolete comment about limitations on Windows

1  2 
color.h
diff --combined color.h
index 6cae166c2b222f008a3c801bec5c485c6fc0b2ff,085924f123e740a228724cb8c006efaa3fecc7ad..90627650fccc67c31261977a22544af131812bd1
+++ b/color.h
@@@ -3,29 -3,21 +3,24 @@@
  
  struct strbuf;
  
 -/*  2 + (2 * num_attrs) + 8 + 1 + 8 + 'm' + NUL */
 -/* "\033[1;2;4;5;7;38;5;2xx;48;5;2xxm\0" */
  /*
   * The maximum length of ANSI color sequence we would generate:
   * - leading ESC '['            2
 - * - attr + ';'                 3 * 10 (e.g. "1;")
 + * - attr + ';'                 2 * num_attr (e.g. "1;")
 + * - no-attr + ';'              3 * num_attr (e.g. "22;")
   * - fg color + ';'             17 (e.g. "38;2;255;255;255;")
   * - bg color + ';'             17 (e.g. "48;2;255;255;255;")
   * - terminating 'm' NUL        2
   *
 - * The above overcounts attr (we only use 5 not 8) and one semicolon
 - * but it is close enough.
 + * The above overcounts by one semicolon but it is close enough.
 + *
 + * The space for attributes is also slightly overallocated, as
 + * the negation for some attributes is the same (e.g., nobold and nodim).
 + *
 + * We allocate space for 7 attributes.
   */
 -#define COLOR_MAXLEN 70
 +#define COLOR_MAXLEN 75
  
- /*
-  * IMPORTANT: Due to the way these color codes are emulated on Windows,
-  * write them only using printf(), fprintf(), and fputs(). In particular,
-  * do not use puts() or write().
-  */
  #define GIT_COLOR_NORMAL      ""
  #define GIT_COLOR_RESET               "\033[m"
  #define GIT_COLOR_BOLD                "\033[1m"
@@@ -78,13 -70,6 +73,13 @@@ extern int color_stdout_is_tty
  int git_color_config(const char *var, const char *value, void *cb);
  int git_color_default_config(const char *var, const char *value, void *cb);
  
 +/*
 + * Set the color buffer (which must be COLOR_MAXLEN bytes)
 + * to the raw color bytes; this is useful for initializing
 + * default color variables.
 + */
 +void color_set(char *dst, const char *color_bytes);
 +
  int git_config_colorbool(const char *var, const char *value);
  int want_color(int var);
  int color_parse(const char *value, char *dst);