summaryrefslogtreecommitdiff
path: root/xdiff/xpatience.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2011-08-17 17:17:16 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2011-08-17 17:17:16 -0700
commitb14b969ab98d5dac835e57a2b6b9e9229b2e1c97 (patch)
tree98ae611f55619bcc45546ff33204900618abf10a /xdiff/xpatience.c
parentxdiff/xprepare: improve O(n*m) performance in xdl_cleanup_records() (diff)
parentxdiff/xhistogram: drop need for additional variable (diff)
downloadtgif-b14b969ab98d5dac835e57a2b6b9e9229b2e1c97.tar.xz
Merge branch 'rc/histogram-diff' into HEAD
* rc/histogram-diff: xdiff/xhistogram: drop need for additional variable xdiff/xhistogram: rely on xdl_trim_ends() xdiff/xhistogram: rework handling of recursed results xdiff: do away with xdl_mmfile_next() Make test number unique xdiff/xprepare: use a smaller sample size for histogram diff xdiff/xprepare: skip classification teach --histogram to diff t4033-diff-patience: factor out tests xdiff/xpatience: factor out fall-back-diff function xdiff/xprepare: refactor abort cleanups xdiff/xprepare: use memset() Conflicts: xdiff/xprepare.c
Diffstat (limited to 'xdiff/xpatience.c')
-rw-r--r--xdiff/xpatience.c27
1 files changed, 2 insertions, 25 deletions
diff --git a/xdiff/xpatience.c b/xdiff/xpatience.c
index e42c16a807..fdd7d0263f 100644
--- a/xdiff/xpatience.c
+++ b/xdiff/xpatience.c
@@ -287,34 +287,11 @@ static int walk_common_sequence(struct hashmap *map, struct entry *first,
static int fall_back_to_classic_diff(struct hashmap *map,
int line1, int count1, int line2, int count2)
{
- /*
- * This probably does not work outside Git, since
- * we have a very simple mmfile structure.
- *
- * Note: ideally, we would reuse the prepared environment, but
- * the libxdiff interface does not (yet) allow for diffing only
- * ranges of lines instead of the whole files.
- */
- mmfile_t subfile1, subfile2;
xpparam_t xpp;
- xdfenv_t env;
-
- subfile1.ptr = (char *)map->env->xdf1.recs[line1 - 1]->ptr;
- subfile1.size = map->env->xdf1.recs[line1 + count1 - 2]->ptr +
- map->env->xdf1.recs[line1 + count1 - 2]->size - subfile1.ptr;
- subfile2.ptr = (char *)map->env->xdf2.recs[line2 - 1]->ptr;
- subfile2.size = map->env->xdf2.recs[line2 + count2 - 2]->ptr +
- map->env->xdf2.recs[line2 + count2 - 2]->size - subfile2.ptr;
xpp.flags = map->xpp->flags & ~XDF_PATIENCE_DIFF;
- if (xdl_do_diff(&subfile1, &subfile2, &xpp, &env) < 0)
- return -1;
- memcpy(map->env->xdf1.rchg + line1 - 1, env.xdf1.rchg, count1);
- memcpy(map->env->xdf2.rchg + line2 - 1, env.xdf2.rchg, count2);
-
- xdl_free_env(&env);
-
- return 0;
+ return xdl_fall_back_diff(map->env, &xpp,
+ line1, count1, line2, count2);
}
/*