diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2021-04-12 17:15:26 (GMT) |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-05-11 03:47:31 (GMT) |
commit | fa59e7beb2a61d9cd1312b212075edf12935fdc6 (patch) | |
tree | b2c976fdc144757d9681c993a88d83423aa7df78 /xdiff-interface.h | |
parent | 9e204422985a518ac700889d1ca4d521b3a7bfb2 (diff) | |
download | git-fa59e7beb2a61d9cd1312b212075edf12935fdc6.zip git-fa59e7beb2a61d9cd1312b212075edf12935fdc6.tar.gz git-fa59e7beb2a61d9cd1312b212075edf12935fdc6.tar.bz2 |
pickaxe -G: terminate early on matching lines
Solve a long-standing item for "git log -Grx" of us e.g. finding "+
str" in the diff context and noting that we had a "hit", but xdiff
diligently continuing to generate and spew the rest of the diff at
us. This makes use of a new "early return" xdiff interface added by
preceding commits.
The TODO item (or, the NEEDSWORK comment) has been there since "git
log -G" was implemented. See f506b8e8b5f (git log/diff: add -G<regexp>
that greps in the patch text, 2010-08-23).
But now with the support added in the preceding changes to the
xdiff-interface we can return early. Let's assert the behavior of that
new early-return xdiff-interface by having a BUG() call here to die if
it ever starts handing us needless work again.
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'xdiff-interface.h')
-rw-r--r-- | xdiff-interface.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/xdiff-interface.h b/xdiff-interface.h index 7d1724a..3b68195 100644 --- a/xdiff-interface.h +++ b/xdiff-interface.h @@ -27,6 +27,10 @@ * doing so will currently make your early return indistinguishable * from an error internal to xdiff, xdiff itself will see that * non-zero return and translate it to -1. + * + * See "diff_grep" in diffcore-pickaxe.c for a trick to work around + * this, i.e. using the "consume_callback_data" to note the desired + * early return. */ typedef int (*xdiff_emit_line_fn)(void *, char *, unsigned long); typedef void (*xdiff_emit_hunk_fn)(void *data, |