diffcore-pickaxe: unify code for log -S/-G
commit61690bf4a1ad499a673995b92cd8ab51104a431c
authorJeff King <peff@peff.net>
Fri, 5 Apr 2013 05:28:10 +0000 (5 01:28 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Apr 2013 17:31:09 +0000 (5 10:31 -0700)
treea3f7ec623aa37cd17dae7052ce6612b283efb5b5
parent88ff684dd54f2a4793387f7162357005a4777ff2
diffcore-pickaxe: unify code for log -S/-G

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 <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diffcore-pickaxe.c