diffcore-pickaxe: port optimization from has_changes() to diff_grep()
commitebb722625805a0e98b5b8c062b79abd8eca1f639
authorJunio C Hamano <gitster@pobox.com>
Fri, 5 Apr 2013 03:40:31 +0000 (4 20:40 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 5 Apr 2013 17:31:09 +0000 (5 10:31 -0700)
treee71c3c0434b492701e87caea73af464ba45d909a
parenta8f6109428b868611c0a59e6894e2b6b38c34e1b
diffcore-pickaxe: port optimization from has_changes() to diff_grep()

These two functions are called in the same codeflow to implement
"log -S<block>" and "log -G<pattern>", respectively, but the latter
lacked two obvious optimizations the former implemented, namely:

 - When a pickaxe limit is not given at all, they should return
   without wasting any cycle;

 - When both sides of the filepair are the same, and the same
   textconv conversion apply to them, return early, as there will be
   no interesting differences between the two anyway.

Also release the filespec data once the processing is done (this is
not about leaking memory--it is about releasing data we finished
looking at as early as possible).

Signed-off-by: Junio C Hamano <gitster@pobox.com>
diffcore-pickaxe.c