<feed xmlns='http://www.w3.org/2005/Atom'>
<title>git/grep.c, branch v1.7.2</title>
<subtitle>Mirror of https://git.kernel.org/pub/scm/git/git.git/
</subtitle>
<id>https://git.shady.money/git/atom?h=v1.7.2</id>
<link rel='self' href='https://git.shady.money/git/atom?h=v1.7.2'/>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/'/>
<updated>2010-05-24T18:22:07Z</updated>
<entry>
<title>grep: support NUL chars in search strings for -F</title>
<updated>2010-05-24T18:22:07Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2010-05-22T21:43:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=ed40a0951cedb70777669144478166aa5bb2cf9c'/>
<id>urn:sha1:ed40a0951cedb70777669144478166aa5bb2cf9c</id>
<content type='text'>
Search patterns in a file specified with -f can contain NUL characters.
The current code ignores all characters on a line after a NUL.

Pass the actual length of the line all the way from the pattern file to
fixmatch() and use it for case-sensitive fixed string matching.

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>grep: use REG_STARTEND for all matching if available</title>
<updated>2010-05-24T18:22:07Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2010-05-22T21:35:07Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f96e56733ab3e3ce5c79c27c673c746af1519a86'/>
<id>urn:sha1:f96e56733ab3e3ce5c79c27c673c746af1519a86</id>
<content type='text'>
Refactor REG_STARTEND handling inlook_ahead() into a new helper,
regmatch(), and use it for line matching, too.  This allows regex
matching beyond NUL characters if regexec() supports the flag.  NUL
characters themselves are not matched in any way, though.

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>grep: continue case insensitive fixed string search after NUL chars</title>
<updated>2010-05-24T18:22:07Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2010-05-22T21:34:06Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=52d799a79f921cc47823a0455b0e646636410b65'/>
<id>urn:sha1:52d799a79f921cc47823a0455b0e646636410b65</id>
<content type='text'>
Functions for C strings, like strcasestr(), can't see beyond NUL
characters.  Check if there is such an obstacle on the line and try
again behind it.

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>grep: use memmem() for fixed string search</title>
<updated>2010-05-24T18:22:06Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2010-05-22T21:32:43Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=1baddf4b3781c0c714442adfda496d667e1850cd'/>
<id>urn:sha1:1baddf4b3781c0c714442adfda496d667e1850cd</id>
<content type='text'>
Allow searching beyond NUL characters by using memmem() instead of
strstr().

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>grep: --name-only over binary</title>
<updated>2010-05-24T18:22:06Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2010-05-22T21:30:48Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=321ffcc0556a94c461ac84667b35494c193804ec'/>
<id>urn:sha1:321ffcc0556a94c461ac84667b35494c193804ec</id>
<content type='text'>
As with the option -c/--count, git grep with the option -l/--name-only
should work the same with binary files as with text files because
there is no danger of messing up the terminal with control characters
from the contents of matching files.  GNU grep does the same.

Move the check for -&gt;name_only before the one for binary_match_only,
thus making the latter irrelevant for git grep -l.

Reported-by: Dmitry Potapov &lt;dpotapov@gmail.com&gt;
Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>grep: --count over binary</title>
<updated>2010-05-24T18:22:06Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2010-05-22T21:29:35Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=c30c10cff1d640ce119596b907c10cc11f83358d'/>
<id>urn:sha1:c30c10cff1d640ce119596b907c10cc11f83358d</id>
<content type='text'>
The intent of showing the message "Binary file xyz matches" for
binary files is to avoid annoying users by potentially messing up
their terminals by printing control characters.  In --count mode,
this precaution isn't necessary.

Display counts of matches if -c/--count was specified, even if -a
was not given.  GNU grep does the same.

Moving the check for -&gt;count before the code for handling binary
file also avoids printing context lines if --count and -[ABC] were
used together, so we can remove the part of the comment that
mentions this behaviour.  Again, GNU grep does the same.

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>grep: grep: refactor handling of binary mode options</title>
<updated>2010-05-24T18:22:06Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2010-05-22T21:28:17Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=64fcec78b5c52a054eab482e91d58f7b41d1dfaf'/>
<id>urn:sha1:64fcec78b5c52a054eab482e91d58f7b41d1dfaf</id>
<content type='text'>
Turn the switch inside-out and add labels for each possible value
of -&gt;binary.  This makes the code easier to read and avoids calling
buffer_is_binary() if the option -a was given.

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/threaded-grep-context'</title>
<updated>2010-04-03T19:28:39Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2010-04-03T19:28:39Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=07b838f087a1535e387d5d4a1414b2b545b73265'/>
<id>urn:sha1:07b838f087a1535e387d5d4a1414b2b545b73265</id>
<content type='text'>
* rs/threaded-grep-context:
  grep: enable threading for context line printing

Conflicts:
	grep.c
</content>
</entry>
<entry>
<title>Merge branch 'ml/color-grep'</title>
<updated>2010-03-20T18:29:36Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2010-03-20T18:29:36Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=f1aa782a3b72a2c4de46dc93b484eb99dc01d4d0'/>
<id>urn:sha1:f1aa782a3b72a2c4de46dc93b484eb99dc01d4d0</id>
<content type='text'>
* ml/color-grep:
  grep: Colorize selected, context, and function lines
  grep: Colorize filename, line number, and separator
  Add GIT_COLOR_BOLD_* and GIT_COLOR_BG_*
</content>
</entry>
<entry>
<title>grep: enable threading for context line printing</title>
<updated>2010-03-15T22:26:35Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2010-03-15T16:21:10Z</published>
<link rel='alternate' type='text/html' href='https://git.shady.money/git/commit/?id=431d6e7bc85f693fe49a04142a8ab4d2d72b0257'/>
<id>urn:sha1:431d6e7bc85f693fe49a04142a8ab4d2d72b0257</id>
<content type='text'>
If context lines are to be printed, grep separates them with hunk marks
("--\n").  These marks are printed between matches from different files,
too.  They are not printed before the first file, though.

Threading was disabled when context line printing was enabled because
avoiding to print the mark before the first line was an unsolved
synchronisation problem.  This patch separates the code for printing
hunk marks for the threaded and the unthreaded case, allowing threading
to be turned on together with the common -ABC options.

-&gt;show_hunk_mark, which controls printing of hunk marks between files in
show_line(), is now set in grep_buffer_1(), but only if some results
have already been printed and threading is disabled.  The threaded case
is handled in work_done().

Signed-off-by: Rene Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
