author | Albert Yale <surfingalbert@gmail.com> | |
Mon, 23 Jan 2012 17:52:44 +0000 (18:52 +0100) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 23 Jan 2012 18:49:34 +0000 (10:49 -0800) | ||
commit | 50dd0f2fd910d9973760db052897ee8e73ed2f1f | |
tree | 0a8ed13e4ccf7220759728cb4436644bdfc515c0 | tree | snapshot |
parent | ced7469f0700216a05b9ca5b58199f3d761a64e5 | commit | diff |
grep: fix -l/-L interaction with decoration lines
In threaded mode, git-grep emits file breaks (enabled with context, -W
and --break) into the accumulation buffers even if they are not
required. The output collection thread then uses skip_first_line to
skip the first such line in the output, which would otherwise be at
the very top.
This is wrong when the user also specified -l/-L/-c, in which case
every line is relevant. While arguably giving these options together
doesn't make any sense, git-grep has always quietly accepted it. So
do not skip anything in these cases.
Signed-off-by: Albert Yale <surfingalbert@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
In threaded mode, git-grep emits file breaks (enabled with context, -W
and --break) into the accumulation buffers even if they are not
required. The output collection thread then uses skip_first_line to
skip the first such line in the output, which would otherwise be at
the very top.
This is wrong when the user also specified -l/-L/-c, in which case
every line is relevant. While arguably giving these options together
doesn't make any sense, git-grep has always quietly accepted it. So
do not skip anything in these cases.
Signed-off-by: Albert Yale <surfingalbert@gmail.com>
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/grep.c | diff | blob | history | |
t/t7810-grep.sh | diff | blob | history |