1
0
mirror of https://github.com/git/git.git synced 2024-11-18 04:23:55 +01:00
git/xdiff
Jeff King 611e42a598 xdiff: provide a separate emit callback for hunks
The xdiff library always emits hunk header lines to our callbacks as
formatted strings like "@@ -a,b +c,d @@\n". This is convenient if we're
going to output a diff, but less so if we actually need to compute using
those numbers, which requires re-parsing the line.

In preparation for moving away from this, let's teach xdiff a new
callback function which gets the broken-out hunk information. To help
callers that don't want to use this new callback, if it's NULL we'll
continue to format the hunk header into a string.

Note that this function renames the "outf" callback to "out_line", as
well. This isn't strictly necessary, but helps in two ways:

  1. Now that there are two callbacks, it's nice to use more descriptive
     names.

  2. Many callers did not zero the emit_callback_data struct, and needed
     to be modified to set ecb.out_hunk to NULL. By changing the name of
     the existing struct member, that guarantees that any new callers
     from in-flight topics will break the build and be examined
     manually.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2018-11-02 20:43:02 +09:00
..
xdiff.h xdiff: provide a separate emit callback for hunks 2018-11-02 20:43:02 +09:00
xdiffi.c Merge branch 'sb/indent-heuristic-optim' 2018-08-17 13:09:57 -07:00
xdiffi.h Replace Free Software Foundation address in license notices 2017-11-09 13:21:21 +09:00
xemit.c xdiff: show non-empty lines before functions with -W 2017-11-21 09:36:06 +09:00
xemit.h Replace Free Software Foundation address in license notices 2017-11-09 13:21:21 +09:00
xhistogram.c xdiff/histogram: remove tail recursion 2018-07-23 10:12:16 -07:00
xinclude.h Replace Free Software Foundation address in license notices 2017-11-09 13:21:21 +09:00
xmacros.h Replace Free Software Foundation address in license notices 2017-11-09 13:21:21 +09:00
xmerge.c Replace Free Software Foundation address in license notices 2017-11-09 13:21:21 +09:00
xpatience.c diff: support anchoring line(s) 2017-11-28 10:40:04 +09:00
xprepare.c Replace Free Software Foundation address in license notices 2017-11-09 13:21:21 +09:00
xprepare.h Replace Free Software Foundation address in license notices 2017-11-09 13:21:21 +09:00
xtypes.h Replace Free Software Foundation address in license notices 2017-11-09 13:21:21 +09:00
xutils.c xdiff: provide a separate emit callback for hunks 2018-11-02 20:43:02 +09:00
xutils.h Replace Free Software Foundation address in license notices 2017-11-09 13:21:21 +09:00