Merge branch 'jk/color-diff-plain-is-context'
authorJunio C Hamano <gitster@pobox.com>
Thu, 11 Jun 2015 16:29:53 +0000 (09:29 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 11 Jun 2015 16:29:53 +0000 (09:29 -0700)
"color.diff.plain" was a misnomer; give it 'color.diff.context' as
a more logical synonym.

* jk/color-diff-plain-is-context:
diff.h: rename DIFF_PLAIN color slot to DIFF_CONTEXT
diff: accept color.diff.context as a synonym for "plain"

1  2 
Documentation/config.txt
combine-diff.c
diff.c
diff.h
line-log.c
index 4d21ce1647f6125584872c8c67823ae8368b1132,b458590f26b56084348a9d392007070007f39f5b..43bb53c0477276d81af484cdb64855698b6a635b
@@@ -914,10 -870,12 +914,11 @@@ command line with the `--color[=<when>]
  color.diff.<slot>::
        Use customized color for diff colorization.  `<slot>` specifies
        which part of the patch to use the specified color, and is one
-       of `plain` (context text), `meta` (metainformation), `frag`
+       of `context` (context text - `plain` is a historical synonym),
+       `meta` (metainformation), `frag`
        (hunk header), 'func' (function in hunk header), `old` (removed lines),
        `new` (added lines), `commit` (commit headers), or `whitespace`
 -      (highlighting whitespace errors). The values of these variables may be
 -      specified as in color.branch.<slot>.
 +      (highlighting whitespace errors).
  
  color.decorate.<slot>::
        Use customized color for 'git log --decorate' output.  `<slot>` is one
diff --cc combine-diff.c
Simple merge
diff --cc diff.c
index 324be1d9592537afd9f51080d3e7a9ab9c5214cf,ff68a70b1bf5002fb0795cad1c6cfbbfcad90847..87b16d5613adb9046501a1b0b285f9f954abbaa5
--- 1/diff.c
--- 2/diff.c
+++ b/diff.c
@@@ -507,30 -498,6 +507,30 @@@ static void emit_line_checked(const cha
        }
  }
  
-                         DIFF_PLAIN, WSEH_CONTEXT, ' ');
 +static void emit_add_line(const char *reset,
 +                        struct emit_callback *ecbdata,
 +                        const char *line, int len)
 +{
 +      emit_line_checked(reset, ecbdata, line, len,
 +                        DIFF_FILE_NEW, WSEH_NEW, '+');
 +}
 +
 +static void emit_del_line(const char *reset,
 +                        struct emit_callback *ecbdata,
 +                        const char *line, int len)
 +{
 +      emit_line_checked(reset, ecbdata, line, len,
 +                        DIFF_FILE_OLD, WSEH_OLD, '-');
 +}
 +
 +static void emit_context_line(const char *reset,
 +                            struct emit_callback *ecbdata,
 +                            const char *line, int len)
 +{
 +      emit_line_checked(reset, ecbdata, line, len,
++                        DIFF_CONTEXT, WSEH_CONTEXT, ' ');
 +}
 +
  static void emit_hunk_header(struct emit_callback *ecbdata,
                             const char *line, int len)
  {
@@@ -1281,27 -1250,17 +1281,27 @@@ static void fn_out_consume(void *priv, 
                return;
        }
  
 -      if (line[0] != '+') {
 -              const char *color =
 -                      diff_get_color(ecbdata->color_diff,
 -                                     line[0] == '-' ? DIFF_FILE_OLD : DIFF_CONTEXT);
 -              ecbdata->lno_in_preimage++;
 -              if (line[0] == ' ')
 -                      ecbdata->lno_in_postimage++;
 -              emit_line(ecbdata->opt, color, reset, line, len);
 -      } else {
 +      switch (line[0]) {
 +      case '+':
                ecbdata->lno_in_postimage++;
                emit_add_line(reset, ecbdata, line + 1, len - 1);
-                         diff_get_color(ecbdata->color_diff, DIFF_PLAIN),
 +              break;
 +      case '-':
 +              ecbdata->lno_in_preimage++;
 +              emit_del_line(reset, ecbdata, line + 1, len - 1);
 +              break;
 +      case ' ':
 +              ecbdata->lno_in_postimage++;
 +              ecbdata->lno_in_preimage++;
 +              emit_context_line(reset, ecbdata, line + 1, len - 1);
 +              break;
 +      default:
 +              /* incomplete line at the end */
 +              ecbdata->lno_in_preimage++;
 +              emit_line(ecbdata->opt,
++                        diff_get_color(ecbdata->color_diff, DIFF_CONTEXT),
 +                        reset, line, len);
 +              break;
        }
  }
  
diff --cc diff.h
Simple merge
diff --cc line-log.c
Simple merge