- delta = diff_delta(src->data, src->size,
- dst->data, dst->size,
- &delta_size);
- /*
- * We currently punt here, but we may later end up parsing the
- * delta to really assess the extent of damage. A big consecutive
- * remove would produce small delta_size that affects quite a
- * big portion of the file.
- */
- free(delta);
-
- /*
- * Now we will give some score to it. 100% edit gets 0 points
- * and 0% edit gets MAX_SCORE points.
- */
- score = MAX_SCORE - (MAX_SCORE * delta_size / base_size);
- if (score < 0) return 0;
- if (MAX_SCORE < score) return MAX_SCORE;
- return score;
-}
-
-static void record_rename_pair(struct diff_queue_struct *outq,
- struct diff_filespec *src,
- struct diff_filespec *dst,
- int rank,
- int score)
-{
- /* The rank is used to sort the final output, because there
- * are certain dependencies.
- *
- * - rank #0 depends on deleted ones.
- * - rank #1 depends on kept files before they are modified.
- * - rank #2 depends on kept files after they are modified;
- * currently not used.
- *
- * Therefore, the final output order should be:
- *
- * 1. rank #0 rename/copy diffs.
- * 2. deletions in the original.
- * 3. rank #1 rename/copy diffs.
- * 4. additions and modifications in the original.
- * 5. rank #2 rename/copy diffs; currently not used.
- *
- * To achieve this sort order, we give xform_work the number
- * above.
- */
- struct diff_filepair *dp = diff_queue(outq, src, dst);
- dp->xfrm_work = (rank * 2 + 1) | (score<<RENAME_SCORE_SHIFT);
- dst->xfrm_flags |= RENAME_DST_MATCHED;
-}