diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-11-13 16:37:27 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-11-13 16:37:27 +0300 |
commit | 39d23dfa409e51844ddda99599927092c8300f12 (patch) | |
tree | f4975a66a1fb9c33a875fe72042e9b7c75519597 /range-diff.c | |
parent | f22838aa7a6dcf308a3307ba17f8afa40989ad3a (diff) | |
parent | 5eade0746e1daf659a9559d804068f9f31614625 (diff) |
Merge branch 'jk/xdiff-interface'
The interface into "xdiff" library used to discover the offset and
size of a generated patch hunk by first formatting it into the
textual hunk header "@@ -n,m +k,l @@" and then parsing the numbers
out. A new interface has been introduced to allow callers a more
direct access to them.
* jk/xdiff-interface:
xdiff-interface: drop parse_hunk_header()
range-diff: use a hunk callback
diff: convert --check to use a hunk callback
combine-diff: use an xdiff hunk callback
diff: use hunk callback for word-diff
diff: discard hunk headers for patch-ids earlier
diff: avoid generating unused hunk header lines
xdiff-interface: provide a separate consume callback for hunks
xdiff: provide a separate emit callback for hunks
Diffstat (limited to 'range-diff.c')
-rw-r--r-- | range-diff.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/range-diff.c b/range-diff.c index bd8083f2d1..3958720f00 100644 --- a/range-diff.c +++ b/range-diff.c @@ -197,6 +197,12 @@ static void diffsize_consume(void *data, char *line, unsigned long len) (*(int *)data)++; } +static void diffsize_hunk(void *data, long ob, long on, long nb, long nn, + const char *funcline, long funclen) +{ + diffsize_consume(data, NULL, 0); +} + static int diffsize(const char *a, const char *b) { xpparam_t pp = { 0 }; @@ -210,7 +216,9 @@ static int diffsize(const char *a, const char *b) mf2.size = strlen(b); cfg.ctxlen = 3; - if (!xdi_diff_outf(&mf1, &mf2, diffsize_consume, &count, &pp, &cfg)) + if (!xdi_diff_outf(&mf1, &mf2, + diffsize_hunk, diffsize_consume, &count, + &pp, &cfg)) return count; error(_("failed to generate diff")); |