general improvements
[gitweb.git] / diffcore-break.c
index c64359f489c87910b9d41756918dacda49276004..875aefd3febf46771cc56c1f2b9f26318cfc732b 100644 (file)
@@ -5,7 +5,8 @@
 #include "diff.h"
 #include "diffcore.h"
 
-static int should_break(struct diff_filespec *src,
+static int should_break(struct repository *r,
+                       struct diff_filespec *src,
                        struct diff_filespec *dst,
                        int break_score,
                        int *merge_score_p)
@@ -58,10 +59,11 @@ static int should_break(struct diff_filespec *src,
        }
 
        if (src->oid_valid && dst->oid_valid &&
-           !oidcmp(&src->oid, &dst->oid))
+           oideq(&src->oid, &dst->oid))
                return 0; /* they are the same */
 
-       if (diff_populate_filespec(src, 0) || diff_populate_filespec(dst, 0))
+       if (diff_populate_filespec(r, src, 0) ||
+           diff_populate_filespec(r, dst, 0))
                return 0; /* error but caught downstream */
 
        max_size = ((src->size > dst->size) ? src->size : dst->size);
@@ -71,7 +73,7 @@ static int should_break(struct diff_filespec *src,
        if (!src->size)
                return 0; /* we do not let empty files get renamed */
 
-       if (diffcore_count_changes(src, dst,
+       if (diffcore_count_changes(r, src, dst,
                                   &src->cnt_data, &dst->cnt_data,
                                   &src_copied, &literal_added))
                return 0;
@@ -114,7 +116,7 @@ static int should_break(struct diff_filespec *src,
        return 1;
 }
 
-void diffcore_break(int break_score)
+void diffcore_break(struct repository *r, int break_score)
 {
        struct diff_queue_struct *q = &diff_queued_diff;
        struct diff_queue_struct outq;
@@ -178,7 +180,7 @@ void diffcore_break(int break_score)
                    object_type(p->one->mode) == OBJ_BLOB &&
                    object_type(p->two->mode) == OBJ_BLOB &&
                    !strcmp(p->one->path, p->two->path)) {
-                       if (should_break(p->one, p->two,
+                       if (should_break(r, p->one, p->two,
                                         break_score, &score)) {
                                /* Split this into delete and create */
                                struct diff_filespec *null_one, *null_two;