Skip to content

Commit 8dbf3eb

Browse files
peffgitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 74b15bf commit 8dbf3eb

File tree

4 files changed

+20
-20
lines changed

4 files changed

+20
-20
lines changed

combine-diff.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -730,7 +730,7 @@ static void dump_sline(struct sline *sline, const char *line_prefix,
730730
const char *c_func = diff_get_color(use_color, DIFF_FUNCINFO);
731731
const char *c_new = diff_get_color(use_color, DIFF_FILE_NEW);
732732
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);
734734
const char *c_reset = diff_get_color(use_color, DIFF_RESET);
735735

736736
if (result_deleted)
@@ -793,7 +793,7 @@ static void dump_sline(struct sline *sline, const char *line_prefix,
793793
}
794794
if (comment_end)
795795
printf("%s%s %s%s", c_reset,
796-
c_plain, c_reset,
796+
c_context, c_reset,
797797
c_func);
798798
for (i = 0; i < comment_end; i++)
799799
putchar(hunk_comment[i]);
@@ -828,7 +828,7 @@ static void dump_sline(struct sline *sline, const char *line_prefix,
828828
*/
829829
if (!context)
830830
continue;
831-
fputs(c_plain, stdout);
831+
fputs(c_context, stdout);
832832
}
833833
else
834834
fputs(c_new, stdout);

diff.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static long diff_algorithm;
4242

4343
static char diff_colors[][COLOR_MAXLEN] = {
4444
GIT_COLOR_RESET,
45-
GIT_COLOR_NORMAL, /* PLAIN */
45+
GIT_COLOR_NORMAL, /* CONTEXT */
4646
GIT_COLOR_BOLD, /* METAINFO */
4747
GIT_COLOR_CYAN, /* FRAGINFO */
4848
GIT_COLOR_RED, /* OLD */
@@ -55,7 +55,7 @@ static char diff_colors[][COLOR_MAXLEN] = {
5555
static int parse_diff_color_slot(const char *var)
5656
{
5757
if (!strcasecmp(var, "context") || !strcasecmp(var, "plain"))
58-
return DIFF_PLAIN;
58+
return DIFF_CONTEXT;
5959
if (!strcasecmp(var, "meta"))
6060
return DIFF_METAINFO;
6161
if (!strcasecmp(var, "frag"))
@@ -501,7 +501,7 @@ static void emit_add_line(const char *reset,
501501
static void emit_hunk_header(struct emit_callback *ecbdata,
502502
const char *line, int len)
503503
{
504-
const char *plain = diff_get_color(ecbdata->color_diff, DIFF_PLAIN);
504+
const char *context = diff_get_color(ecbdata->color_diff, DIFF_CONTEXT);
505505
const char *frag = diff_get_color(ecbdata->color_diff, DIFF_FRAGINFO);
506506
const char *func = diff_get_color(ecbdata->color_diff, DIFF_FUNCINFO);
507507
const char *reset = diff_get_color(ecbdata->color_diff, DIFF_RESET);
@@ -518,7 +518,7 @@ static void emit_hunk_header(struct emit_callback *ecbdata,
518518
if (len < 10 ||
519519
memcmp(line, atat, 2) ||
520520
!(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);
522522
return;
523523
}
524524
ep += 2; /* skip over @@ */
@@ -540,7 +540,7 @@ static void emit_hunk_header(struct emit_callback *ecbdata,
540540
if (*ep != ' ' && *ep != '\t')
541541
break;
542542
if (ep != cp) {
543-
strbuf_addstr(&msgbuf, plain);
543+
strbuf_addstr(&msgbuf, context);
544544
strbuf_add(&msgbuf, cp, ep - cp);
545545
strbuf_addstr(&msgbuf, reset);
546546
}
@@ -623,10 +623,10 @@ static void emit_rewrite_lines(struct emit_callback *ecb,
623623
data += len;
624624
}
625625
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);
628628
putc('\n', ecb->opt->file);
629-
emit_line_0(ecb->opt, plain, reset, '\\',
629+
emit_line_0(ecb->opt, context, reset, '\\',
630630
nneof, strlen(nneof));
631631
}
632632
}
@@ -1086,7 +1086,7 @@ static void init_diff_words_data(struct emit_callback *ecbdata,
10861086
struct diff_words_style *st = ecbdata->diff_words->style;
10871087
st->old.color = diff_get_color_opt(o, DIFF_FILE_OLD);
10881088
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);
10901090
}
10911091
}
10921092

@@ -1162,7 +1162,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
11621162
{
11631163
struct emit_callback *ecbdata = priv;
11641164
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);
11661166
const char *reset = diff_get_color(ecbdata->color_diff, DIFF_RESET);
11671167
struct diff_options *o = ecbdata->opt;
11681168
const char *line_prefix = diff_line_prefix(o);
@@ -1233,7 +1233,7 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
12331233
}
12341234
diff_words_flush(ecbdata);
12351235
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);
12371237
fputs("~\n", ecbdata->opt->file);
12381238
} else {
12391239
/*
@@ -1245,15 +1245,15 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
12451245
line++;
12461246
len--;
12471247
}
1248-
emit_line(ecbdata->opt, plain, reset, line, len);
1248+
emit_line(ecbdata->opt, context, reset, line, len);
12491249
}
12501250
return;
12511251
}
12521252

12531253
if (line[0] != '+') {
12541254
const char *color =
12551255
diff_get_color(ecbdata->color_diff,
1256-
line[0] == '-' ? DIFF_FILE_OLD : DIFF_PLAIN);
1256+
line[0] == '-' ? DIFF_FILE_OLD : DIFF_CONTEXT);
12571257
ecbdata->lno_in_preimage++;
12581258
if (line[0] == ' ')
12591259
ecbdata->lno_in_postimage++;

diff.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ struct diff_options {
175175

176176
enum color_diff {
177177
DIFF_RESET = 0,
178-
DIFF_PLAIN = 1,
178+
DIFF_CONTEXT = 1,
179179
DIFF_METAINFO = 2,
180180
DIFF_FRAGINFO = 3,
181181
DIFF_FILE_OLD = 4,

line-log.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ static void dump_diff_hacky_one(struct rev_info *rev, struct line_log_data *rang
893893
const char *c_meta = diff_get_color(opt->use_color, DIFF_METAINFO);
894894
const char *c_old = diff_get_color(opt->use_color, DIFF_FILE_OLD);
895895
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);
897897

898898
if (!pair || !diff)
899899
return;
@@ -957,7 +957,7 @@ static void dump_diff_hacky_one(struct rev_info *rev, struct line_log_data *rang
957957
int k;
958958
for (; t_cur < diff->target.ranges[j].start; t_cur++)
959959
print_line(prefix, ' ', t_cur, t_ends, pair->two->data,
960-
c_plain, c_reset);
960+
c_context, c_reset);
961961
for (k = diff->parent.ranges[j].start; k < diff->parent.ranges[j].end; k++)
962962
print_line(prefix, '-', k, p_ends, pair->one->data,
963963
c_old, c_reset);
@@ -968,7 +968,7 @@ static void dump_diff_hacky_one(struct rev_info *rev, struct line_log_data *rang
968968
}
969969
for (; t_cur < t_end; t_cur++)
970970
print_line(prefix, ' ', t_cur, t_ends, pair->two->data,
971-
c_plain, c_reset);
971+
c_context, c_reset);
972972
}
973973

974974
free(p_ends);

0 commit comments

Comments
 (0)