Merge branch 'jk/push-delete-ref-error-message'
[gitweb.git] / xdiff / xdiffi.c
index bc889e87894fbd261db8aaf29723e8df35f913da..1b7012a119ad3ea7e2ebe0aad80891529d4936da 100644 (file)
@@ -538,13 +538,26 @@ void xdl_free_script(xdchange_t *xscr) {
        }
 }
 
+static int xdl_call_hunk_func(xdfenv_t *xe, xdchange_t *xscr, xdemitcb_t *ecb,
+                             xdemitconf_t const *xecfg)
+{
+       xdchange_t *xch, *xche;
+
+       for (xch = xscr; xch; xch = xche->next) {
+               xche = xdl_get_hunk(xch, xecfg);
+               if (xecfg->hunk_func(xch->i1, xche->i1 + xche->chg1 - xch->i1,
+                                    xch->i2, xche->i2 + xche->chg2 - xch->i2,
+                                    ecb->priv) < 0)
+                       return -1;
+       }
+       return 0;
+}
 
 int xdl_diff(mmfile_t *mf1, mmfile_t *mf2, xpparam_t const *xpp,
             xdemitconf_t const *xecfg, xdemitcb_t *ecb) {
        xdchange_t *xscr;
        xdfenv_t xe;
-       emit_func_t ef = xecfg->emit_func ?
-               (emit_func_t)xecfg->emit_func : xdl_emit_diff;
+       emit_func_t ef = xecfg->hunk_func ? xdl_call_hunk_func : xdl_emit_diff;
 
        if (xdl_do_diff(mf1, mf2, xpp, &xe) < 0) {