Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
diff.c: emit_diff_symbol learns DIFF_SYMBOL_CONTEXT_MARKER
author
Stefan Beller
<sbeller@google.com>
Fri, 30 Jun 2017 00:06:50 +0000
(17:06 -0700)
committer
Junio C Hamano
<gitster@pobox.com>
Fri, 30 Jun 2017 20:13:01 +0000
(13:13 -0700)
Signed-off-by: Stefan Beller <sbeller@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diff.c
patch
|
blob
|
history
raw
|
patch
|
inline
| side by side (parent:
36a4cef
)
diff --git
a/diff.c
b/diff.c
index 4637368d59c75e1013068927cc1e5e4243347478..75b996c4cf17d712d7430c24869208263d05f064 100644
(file)
--- a/
diff.c
+++ b/
diff.c
@@
-561,13
+561,20
@@
static void emit_line(struct diff_options *o, const char *set, const char *reset
}
enum diff_symbol {
}
enum diff_symbol {
+ DIFF_SYMBOL_CONTEXT_MARKER,
DIFF_SYMBOL_SEPARATOR
};
static void emit_diff_symbol(struct diff_options *o, enum diff_symbol s,
const char *line, int len)
{
DIFF_SYMBOL_SEPARATOR
};
static void emit_diff_symbol(struct diff_options *o, enum diff_symbol s,
const char *line, int len)
{
+ const char *context, *reset;
switch (s) {
switch (s) {
+ case DIFF_SYMBOL_CONTEXT_MARKER:
+ context = diff_get_color_opt(o, DIFF_CONTEXT);
+ reset = diff_get_color_opt(o, DIFF_RESET);
+ emit_line(o, context, reset, line, len);
+ break;
case DIFF_SYMBOL_SEPARATOR:
fprintf(o->file, "%s%c",
diff_line_prefix(o),
case DIFF_SYMBOL_SEPARATOR:
fprintf(o->file, "%s%c",
diff_line_prefix(o),
@@
-662,7
+669,8
@@
static void emit_hunk_header(struct emit_callback *ecbdata,
if (len < 10 ||
memcmp(line, atat, 2) ||
!(ep = memmem(line + 2, len - 2, atat, 2))) {
if (len < 10 ||
memcmp(line, atat, 2) ||
!(ep = memmem(line + 2, len - 2, atat, 2))) {
- emit_line(ecbdata->opt, context, reset, line, len);
+ emit_diff_symbol(ecbdata->opt,
+ DIFF_SYMBOL_CONTEXT_MARKER, line, len);
return;
}
ep += 2; /* skip over @@ */
return;
}
ep += 2; /* skip over @@ */