<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/git.git/diffcore-pickaxe.c, branch v2.7.0-rc2</title>
<subtitle>Git
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v2.7.0-rc2</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/atom?h=v2.7.0-rc2'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/'/>
<updated>2015-09-28T21:57:10Z</updated>
<entry>
<title>react to errors in xdi_diff</title>
<updated>2015-09-28T21:57:10Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2015-09-24T23:12:23Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=3efb988098858bf6b974b1e673a190f9d2965d1d'/>
<id>urn:sha1:3efb988098858bf6b974b1e673a190f9d2965d1d</id>
<content type='text'>
When we call into xdiff to perform a diff, we generally lose
the return code completely. Typically by ignoring the return
of our xdi_diff wrapper, but sometimes we even propagate
that return value up and then ignore it later.  This can
lead to us silently producing incorrect diffs (e.g., "git
log" might produce no output at all, not even a diff header,
for a content-level diff).

In practice this does not happen very often, because the
typical reason for xdiff to report failure is that it
malloc() failed (it uses straight malloc, and not our
xmalloc wrapper).  But it could also happen when xdiff
triggers one our callbacks, which returns an error (e.g.,
outf() in builtin/rerere.c tries to report a write failure
in this way). And the next patch also plans to add more
failure modes.

Let's notice an error return from xdiff and react
appropriately. In most of the diff.c code, we can simply
die(), which matches the surrounding code (e.g., that is
what we do if we fail to load a file for diffing in the
first place). This is not that elegant, but we are probably
better off dying to let the user know there was a problem,
rather than simply generating bogus output.

We could also just die() directly in xdi_diff, but the
callers typically have a bit more context, and can provide a
better message (and if we do later decide to pass errors up,
we're one step closer to doing so).

There is one interesting case, which is in diff_grep(). Here
if we cannot generate the diff, there is nothing to match,
and we silently return "no hits". This is actually what the
existing code does already, but we make it a little more
explicit.

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pickaxe: simplify kwset loop in contains()</title>
<updated>2014-03-24T22:13:17Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-03-22T17:16:00Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=e4aab50475c1d384e016c6ac6548635f1ddcd3fe'/>
<id>urn:sha1:e4aab50475c1d384e016c6ac6548635f1ddcd3fe</id>
<content type='text'>
Inlining the variable "found" actually makes the code shorter and
easier to read.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pickaxe: call strlen only when necessary in diffcore_pickaxe_count()</title>
<updated>2014-03-24T22:13:17Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-03-22T17:15:59Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=542b2aa2c9afba71febb248edb3083ff9cacf065'/>
<id>urn:sha1:542b2aa2c9afba71febb248edb3083ff9cacf065</id>
<content type='text'>
We need to determine the search term's length only when fixed-string
matching is used; regular expression compilation takes a NUL-terminated
string directly.  Only call strlen() in the former case.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pickaxe: move pickaxe() after pickaxe_match()</title>
<updated>2014-03-24T22:13:10Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-03-22T17:15:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=3753bd1f69d3b17e0369390fb8960ae3b7855b70'/>
<id>urn:sha1:3753bd1f69d3b17e0369390fb8960ae3b7855b70</id>
<content type='text'>
pickaxe() calls pickaxe_match(); moving the definition of the former
after the latter allows us to do without an explicit function
declaration.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pickaxe: merge diffcore_pickaxe_grep() and diffcore_pickaxe_count() into diffcore_pickaxe()</title>
<updated>2014-03-24T22:12:45Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-03-22T17:15:57Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=63b52afaa88bf89c781fe11c6803ff1dcc47d424'/>
<id>urn:sha1:63b52afaa88bf89c781fe11c6803ff1dcc47d424</id>
<content type='text'>
diffcore_pickaxe_count() initializes the regular expression or kwset for
the search term, calls pickaxe() with the callback has_changes() and
cleans up afterwards.  diffcore_pickaxe_grep() does the same, only it
doesn't support kwset and uses the callback diff_grep() instead.  Merge
the two functions to form the new diffcore_pickaxe() and thus get rid of
the duplicate regex setup and cleanup code.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>pickaxe: honor -i when used with -S and --pickaxe-regex</title>
<updated>2014-03-24T22:12:45Z</updated>
<author>
<name>René Scharfe</name>
<email>l.s.r@web.de</email>
</author>
<published>2014-03-22T17:15:56Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=218c45a45c4e1c3b09a1b6b2bc6e6ed457e38a9f'/>
<id>urn:sha1:218c45a45c4e1c3b09a1b6b2bc6e6ed457e38a9f</id>
<content type='text'>
accccde4 (pickaxe: allow -i to search in patch case-insensitively)
allowed case-insenitive matching for -G and -S, but for the latter
only if fixed string matching is used.  Allow it for -S and regular
expression matching as well to make the support complete.

Signed-off-by: Rene Scharfe &lt;l.s.r@web.de&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'rs/pickaxe-simplify'</title>
<updated>2013-07-12T19:04:17Z</updated>
<author>
<name>Junio C Hamano</name>
<email>gitster@pobox.com</email>
</author>
<published>2013-07-12T19:04:17Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=d5a3897f94dc4a2a77f30eeaf39cf14468061d0d'/>
<id>urn:sha1:d5a3897f94dc4a2a77f30eeaf39cf14468061d0d</id>
<content type='text'>
* rs/pickaxe-simplify:
  diffcore-pickaxe: simplify has_changes and contains
</content>
</entry>
<entry>
<title>diffcore-pickaxe: simplify has_changes and contains</title>
<updated>2013-07-07T17:24:11Z</updated>
<author>
<name>René Scharfe</name>
<email>rene.scharfe@lsrfire.ath.cx</email>
</author>
<published>2013-07-06T13:53:27Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=3bdb5b9f1fe964dc9ac4aa29b7b80b1e89ba84dc'/>
<id>urn:sha1:3bdb5b9f1fe964dc9ac4aa29b7b80b1e89ba84dc</id>
<content type='text'>
Halve the number of callsites of contains() to two using temporary
variables, simplifying the code.  While at it, get rid of the
diff_options parameter, which became unused with 8fa4b09f.

Signed-off-by: René Scharfe &lt;rene.scharfe@lsrfire.ath.cx&gt;
Acked-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diffcore-pickaxe: make error messages more consistent</title>
<updated>2013-06-03T17:50:22Z</updated>
<author>
<name>Ramkumar Ramachandra</name>
<email>artagnon@gmail.com</email>
</author>
<published>2013-05-31T12:12:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=276b22d333d4207928f6cfe3ab7c1898cd509b88'/>
<id>urn:sha1:276b22d333d4207928f6cfe3ab7c1898cd509b88</id>
<content type='text'>
Currently, diffcore-pickaxe reports two distinct errors for the same
user error:

    $ git log --pickaxe-regex -S'\1'
    fatal: invalid pickaxe regex: Invalid back reference

    $ git log -G'\1'
    fatal: invalid log-grep regex: Invalid back reference

This "log-grep" was only an internal name for the -G feature during
development, and invite confusion with "git log --grep=&lt;pattern&gt;".

Change the error messages to say "invalid regex".

Signed-off-by: Ramkumar Ramachandra &lt;artagnon@gmail.com&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
<entry>
<title>diffcore-pickaxe: unify code for log -S/-G</title>
<updated>2013-04-05T17:31:09Z</updated>
<author>
<name>Jeff King</name>
<email>peff@peff.net</email>
</author>
<published>2013-04-05T05:28:10Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/git.git/commit/?id=61690bf4a1ad499a673995b92cd8ab51104a431c'/>
<id>urn:sha1:61690bf4a1ad499a673995b92cd8ab51104a431c</id>
<content type='text'>
The logic flow of has_changes() used for "log -S" and diff_grep()
used for "log -G" are essentially the same.  See if we have both
sides that could be different in any interesting way, slurp the
contents in core, possibly after applying textconv, inspect the
contents, clean-up and report the result.  The only difference
between the two is how "inspect" step works.

Unify this codeflow in a helper, pickaxe_match(), which takes a
callback function that implements the specific "inspect" step.

After removing the common scaffolding code from the existing
has_changes() and diff_grep(), they each becomes such a callback
function suitable for passing to pickaxe_match().

Signed-off-by: Jeff King &lt;peff@peff.net&gt;
Signed-off-by: Junio C Hamano &lt;gitster@pobox.com&gt;
</content>
</entry>
</feed>
