summaryrefslogtreecommitdiff
path: root/diffcore-break.c
diff options
context:
space:
mode:
authorNguyễn Thái Ngọc Duy <pclouds@gmail.com>2018-09-21 15:57:19 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-09-21 16:48:10 (GMT)
commitb78ea5fc3574a2ce262cfb37a7ea890caddd0cf5 (patch)
treefa241215b447ccd61db65f6a44356b7f93344854 /diffcore-break.c
parent92a1bf5a58920e5f1f51106f06cd9dc6d6eb6c43 (diff)
downloadgit-b78ea5fc3574a2ce262cfb37a7ea890caddd0cf5.zip
git-b78ea5fc3574a2ce262cfb37a7ea890caddd0cf5.tar.gz
git-b78ea5fc3574a2ce262cfb37a7ea890caddd0cf5.tar.bz2
diff.c: reduce implicit dependency on the_index
diff and textconv code has so widespread use that it's hard to simply update their api and all call sites at once because it would result in a big patch. For now reduce the_index references to two places: diff_setup() and fill_textconv(). Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diffcore-break.c')
-rw-r--r--diffcore-break.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/diffcore-break.c b/diffcore-break.c
index c64359f..b580d92 100644
--- a/diffcore-break.c
+++ b/diffcore-break.c
@@ -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)
@@ -61,7 +62,8 @@ static int should_break(struct diff_filespec *src,
!oidcmp(&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;