diff.h: rename DIFF_PLAIN color slot to DIFF_CONTEXT
The latter is a much more descriptive name (and we support "color.diff.context" now). This also updates the name of any local variables which were used to store the color. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
May 27, 2015 at 16:48 UTC
8dbf3eb6850d6d9495ace908625fe50888b111e6
4 files changed
+20
-20
combine-diff.c
+3
-3
@@ -730,7 +730,7 @@ static void dump_sline(struct sline *sline, const char *line_prefix,
730
const char *c_func = diff_get_color(use_color, DIFF_FUNCINFO);
731
const char *c_new = diff_get_color(use_color, DIFF_FILE_NEW);
732
const char *c_old = diff_get_color(use_color, DIFF_FILE_OLD);
733
- const char *c_plain = diff_get_color(use_color, DIFF_PLAIN);
733
+ const char *c_context = diff_get_color(use_color, DIFF_CONTEXT);
734
const char *c_reset = diff_get_color(use_color, DIFF_RESET);
735
736
if (result_deleted)
@@ -793,7 +793,7 @@ static void dump_sline(struct sline *sline, const char *line_prefix,
793
}
794
if (comment_end)
795
printf("%s%s %s%s", c_reset,
796
- c_plain, c_reset,
796
+ c_context, c_reset,
797
c_func);
798
for (i = 0; i < comment_end; i++)
799
putchar(hunk_comment[i]);
@@ -828,7 +828,7 @@ static void dump_sline(struct sline *sline, const char *line_prefix,
828
*/
829
if (!context)
830
continue;
831
- fputs(c_plain, stdout);
831
+ fputs(c_context, stdout);
832
}
833
else
834
fputs(c_new, stdout);
diff.c
+13
-13
@@ -42,7 +42,7 @@ static long diff_algorithm;
42
43
static char diff_colors[][COLOR_MAXLEN] = {
44
GIT_COLOR_RESET,
45
- GIT_COLOR_NORMAL, /* PLAIN */
45
+ GIT_COLOR_NORMAL, /* CONTEXT */
46
GIT_COLOR_BOLD, /* METAINFO */
47
GIT_COLOR_CYAN, /* FRAGINFO */
48
GIT_COLOR_RED, /* OLD */
@@ -55,7 +55,7 @@ static char diff_colors[][COLOR_MAXLEN] = {
55
static int parse_diff_color_slot(const char *var)
56
{
57
if (!strcasecmp(var, "context") || !strcasecmp(var, "plain"))
58
- return DIFF_PLAIN;
58
+ return DIFF_CONTEXT;
59
if (!strcasecmp(var, "meta"))
60
return DIFF_METAINFO;
61
if (!strcasecmp(var, "frag"))
@@ -501,7 +501,7 @@ static void emit_add_line(const char *reset,
501
static void emit_hunk_header(struct emit_callback *ecbdata,
502
const char *line, int len)
503
{
504
- const char *plain = diff_get_color(ecbdata->color_diff, DIFF_PLAIN);
504
+ const char *context = diff_get_color(ecbdata->color_diff, DIFF_CONTEXT);
505
const char *frag = diff_get_color(ecbdata->color_diff, DIFF_FRAGINFO);
506
const char *func = diff_get_color(ecbdata->color_diff, DIFF_FUNCINFO);
507
const char *reset = diff_get_color(ecbdata->color_diff, DIFF_RESET);
@@ -518,7 +518,7 @@ static void emit_hunk_header(struct emit_callback *ecbdata,
518
if (len < 10 ||
519
memcmp(line, atat, 2) ||
520
!(ep = memmem(line + 2, len - 2, atat, 2))) {
521
- emit_line(ecbdata->opt, plain, reset, line, len);
521
+ emit_line(ecbdata->opt, context, reset, line, len);
522
return;
523
}
524
ep += 2; /* skip over @@ */
@@ -540,7 +540,7 @@ static void emit_hunk_header(struct emit_callback *ecbdata,
540
if (*ep != ' ' && *ep != '\t')
541
break;
542
if (ep != cp) {
543
- strbuf_addstr(&msgbuf, plain);
543
+ strbuf_addstr(&msgbuf, context);
544
strbuf_add(&msgbuf, cp, ep - cp);
545
strbuf_addstr(&msgbuf, reset);
546
}
@@ -623,10 +623,10 @@ static void emit_rewrite_lines(struct emit_callback *ecb,
623
data += len;
624
}
625
if (!endp) {
626
- const char *plain = diff_get_color(ecb->color_diff,
627
- DIFF_PLAIN);
626
+ const char *context = diff_get_color(ecb->color_diff,
627
+ DIFF_CONTEXT);
628
putc('\n', ecb->opt->file);
629
- emit_line_0(ecb->opt, plain, reset, '\\',
629
+ emit_line_0(ecb->opt, context, reset, '\\',
630
nneof, strlen(nneof));
631
}
632
}
@@ -1086,7 +1086,7 @@ static void init_diff_words_data(struct emit_callback *ecbdata,
1086
struct diff_words_style *st = ecbdata->diff_words->style;
1087
st->old.color = diff_get_color_opt(o, DIFF_FILE_OLD);
1088
st->new.color = diff_get_color_opt(o, DIFF_FILE_NEW);
1089
- st->ctx.color = diff_get_color_opt(o, DIFF_PLAIN);
1089
+ st->ctx.color = diff_get_color_opt(o, DIFF_CONTEXT);
1090
}
1091
}
1092
@@ -1162,7 +1162,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1162
{
1163
struct emit_callback *ecbdata = priv;
1164
const char *meta = diff_get_color(ecbdata->color_diff, DIFF_METAINFO);
1165
- const char *plain = diff_get_color(ecbdata->color_diff, DIFF_PLAIN);
1165
+ const char *context = diff_get_color(ecbdata->color_diff, DIFF_CONTEXT);
1166
const char *reset = diff_get_color(ecbdata->color_diff, DIFF_RESET);
1167
struct diff_options *o = ecbdata->opt;
1168
const char *line_prefix = diff_line_prefix(o);
@@ -1233,7 +1233,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1233
}
1234
diff_words_flush(ecbdata);
1235
if (ecbdata->diff_words->type == DIFF_WORDS_PORCELAIN) {
1236
- emit_line(ecbdata->opt, plain, reset, line, len);
1236
+ emit_line(ecbdata->opt, context, reset, line, len);
1237
fputs("~\n", ecbdata->opt->file);
1238
} else {
1239
/*
@@ -1245,7 +1245,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1245
line++;
1246
len--;
1247
}
1248
- emit_line(ecbdata->opt, plain, reset, line, len);
1248
+ emit_line(ecbdata->opt, context, reset, line, len);
1249
}
1250
return;
1251
}
@@ -1253,7 +1253,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
1253
if (line[0] != '+') {
1254
const char *color =
1255
diff_get_color(ecbdata->color_diff,
1256
- line[0] == '-' ? DIFF_FILE_OLD : DIFF_PLAIN);
1256
+ line[0] == '-' ? DIFF_FILE_OLD : DIFF_CONTEXT);
1257
ecbdata->lno_in_preimage++;
1258
if (line[0] == ' ')
1259
ecbdata->lno_in_postimage++;
diff.h
+1
-1
@@ -175,7 +175,7 @@ struct diff_options {
175
176
enum color_diff {
177
DIFF_RESET = 0,
178
- DIFF_PLAIN = 1,
178
+ DIFF_CONTEXT = 1,
179
DIFF_METAINFO = 2,
180
DIFF_FRAGINFO = 3,
181
DIFF_FILE_OLD = 4,
line-log.c
+3
-3
@@ -893,7 +893,7 @@ static void dump_diff_hacky_one(struct rev_info *rev, struct line_log_data *rang
893
const char *c_meta = diff_get_color(opt->use_color, DIFF_METAINFO);
894
const char *c_old = diff_get_color(opt->use_color, DIFF_FILE_OLD);
895
const char *c_new = diff_get_color(opt->use_color, DIFF_FILE_NEW);
896
- const char *c_plain = diff_get_color(opt->use_color, DIFF_PLAIN);
896
+ const char *c_context = diff_get_color(opt->use_color, DIFF_CONTEXT);
897
898
if (!pair || !diff)
899
return;
@@ -957,7 +957,7 @@ static void dump_diff_hacky_one(struct rev_info *rev, struct line_log_data *rang
957
int k;
958
for (; t_cur < diff->target.ranges[j].start; t_cur++)
959
print_line(prefix, ' ', t_cur, t_ends, pair->two->data,
960
- c_plain, c_reset);
960
+ c_context, c_reset);
961
for (k = diff->parent.ranges[j].start; k < diff->parent.ranges[j].end; k++)
962
print_line(prefix, '-', k, p_ends, pair->one->data,
963
c_old, c_reset);
@@ -968,7 +968,7 @@ static void dump_diff_hacky_one(struct rev_info *rev, struct line_log_data *rang
968
}
969
for (; t_cur < t_end; t_cur++)
970
print_line(prefix, ' ', t_cur, t_ends, pair->two->data,
971
- c_plain, c_reset);
971
+ c_context, c_reset);
972
}
973
974
free(p_ends);