grep: simplify -p output
It was found a bit too loud to show == separators between the function headers. Signed-off-by: Rene Scharfe <rene.scharfe@lsrfire.ath.cx> Signed-off-by: Junio C Hamano <gitster@pobox.com>
René Scharfe committed
Jul 2, 2009 at 00:06 UTC
ed24e401e0e6ab860475b8575e28a2c6ea99cc69
2 files changed
+6
-10
builtin-grep.c
+2
-2
@@ -285,13 +285,13 @@ static int flush_grep(struct grep_opt *opt,
285
argc -= 2;
286
}
287
288
- if (opt->pre_context || opt->post_context || opt->funcname) {
288
+ if (opt->pre_context || opt->post_context) {
289
/*
290
* grep handles hunk marks between files, but we need to
291
* do that ourselves between multiple calls.
292
*/
293
if (opt->show_hunk_mark)
294
- write_or_die(1, opt->funcname ? "==\n" : "--\n", 3);
294
+ write_or_die(1, "--\n", 3);
295
else
296
opt->show_hunk_mark = 1;
297
}
grep.c
+4
-8
@@ -491,18 +491,14 @@ static void show_line(struct grep_opt *opt, char *bol, char *eol,
491
{
492
int rest = eol - bol;
493
494
- if (opt->pre_context || opt->post_context || opt->funcname) {
494
+ if (opt->pre_context || opt->post_context) {
495
if (opt->last_shown == 0) {
496
if (opt->show_hunk_mark)
497
- fputs(opt->funcname ? "==\n" : "--\n", stdout);
497
+ fputs("--\n", stdout);
498
else
499
opt->show_hunk_mark = 1;
500
- } else if (lno > opt->last_shown + 1) {
501
- if (opt->pre_context || opt->post_context)
502
- fputs((sign == '=') ? "==\n" : "--\n", stdout);
503
- else if (sign == '=')
504
- fputs("==\n", stdout);
505
- }
500
+ } else if (lno > opt->last_shown + 1)
501
+ fputs("--\n", stdout);
502
}
503
opt->last_shown = lno;
504