diff options
author | Junio C Hamano <gitster@pobox.com> | 2007-09-14 00:31:00 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-09-14 15:16:43 -0700 |
commit | d99ebf081797dbb43ff618ff59f4c607b0acf045 (patch) | |
tree | 58a480bcd263f0c49606916b5a3286ae38bc1c74 /Documentation | |
parent | Documentation/git-config.txt: AsciiDoc tweak to avoid leading dot (diff) | |
download | tgif-d99ebf081797dbb43ff618ff59f4c607b0acf045.tar.xz |
Split grep arguments in a way that does not requires to add /dev/null.
In order to (almost) always show the name of the file without
relying on "-H" option of GNU grep, we used to add /dev/null to
the argument list unless we are doing -l or -L. This caused
"/dev/null:0" to show up when -c is given in the output.
It is not enough to add -c to the set of options we do not pass
/dev/null for. When we have too many files, we invoke grep
multiple times and we need to avoid giving a widow filename to
the last invocation -- otherwise we will not see the name.
This keeps two filenames when the argv[] buffer is about to
overflow and we have not finished iterating over the index, so
that the last round will always have at least two paths to work
with (and not require /dev/null).
An obvious and the only exception is when there is only 1 file
that is given to the underlying grep, and in that case we avoid
passing /dev/null and let the external "grep -c" report only the
number of matches.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'Documentation')
0 files changed, 0 insertions, 0 deletions