Skip to content

Commit ed24e40

Browse files
René Scharfegitster
authored andcommitted
grep: simplify -p output
It was found a bit too loud to show == separators between the function headers. Signed-off-by: Rene Scharfe <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 60ecac9 commit ed24e40

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

builtin-grep.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,13 +285,13 @@ static int flush_grep(struct grep_opt *opt,
285285
argc -= 2;
286286
}
287287

288-
if (opt->pre_context || opt->post_context || opt->funcname) {
288+
if (opt->pre_context || opt->post_context) {
289289
/*
290290
* grep handles hunk marks between files, but we need to
291291
* do that ourselves between multiple calls.
292292
*/
293293
if (opt->show_hunk_mark)
294-
write_or_die(1, opt->funcname ? "==\n" : "--\n", 3);
294+
write_or_die(1, "--\n", 3);
295295
else
296296
opt->show_hunk_mark = 1;
297297
}

grep.c

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -491,18 +491,14 @@ static void show_line(struct grep_opt *opt, char *bol, char *eol,
491491
{
492492
int rest = eol - bol;
493493

494-
if (opt->pre_context || opt->post_context || opt->funcname) {
494+
if (opt->pre_context || opt->post_context) {
495495
if (opt->last_shown == 0) {
496496
if (opt->show_hunk_mark)
497-
fputs(opt->funcname ? "==\n" : "--\n", stdout);
497+
fputs("--\n", stdout);
498498
else
499499
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);
506502
}
507503
opt->last_shown = lno;
508504

0 commit comments

Comments
 (0)