X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=grep.c;h=543b1d53784c16020dea089f23c431c7f2608425;hb=9ca5df90615aa3c6b60e1bc8f03db6cae98e816c;hp=fdc42062687fa6b8bb77c8d09ed58aee9107692d;hpb=797d44343c831680aeae3392259fcadeb178bf61;p=git.git diff --git a/grep.c b/grep.c index fdc420626..543b1d537 100644 --- a/grep.c +++ b/grep.c @@ -570,8 +570,7 @@ static void show_line(struct grep_opt *opt, char *bol, char *eol, if (opt->show_hunk_mark) { output_color(opt, "--", 2, opt->color_sep); opt->output(opt, "\n", 1); - } else - opt->show_hunk_mark = 1; + } } else if (lno > opt->last_shown + 1) { output_color(opt, "--", 2, opt->color_sep); opt->output(opt, "\n", 1); @@ -772,14 +771,6 @@ int grep_threads_ok(const struct grep_opt *opt) !opt->name_only) return 0; - /* If we are showing hunk marks, we should not do it for the - * first match. The synchronization problem we get for this - * constraint is not yet solved, so we disable threading in - * this case. - */ - if (opt->pre_context || opt->post_context) - return 0; - return 1; } @@ -801,11 +792,14 @@ static int grep_buffer_1(struct grep_opt *opt, const char *name, enum grep_context ctx = GREP_CONTEXT_HEAD; xdemitconf_t xecfg; - opt->last_shown = 0; - if (!opt->output) opt->output = std_output; + if (opt->last_shown && (opt->pre_context || opt->post_context) && + opt->output == std_output) + opt->show_hunk_mark = 1; + opt->last_shown = 0; + if (buffer_is_binary(buf, size)) { switch (opt->binary) { case GREP_BINARY_DEFAULT: