summaryrefslogtreecommitdiff
path: root/diffcore-delta.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-delta.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-delta.c')
-rw-r--r--diffcore-delta.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/diffcore-delta.c b/diffcore-delta.c
index c83d45a..5668ace 100644
--- a/diffcore-delta.c
+++ b/diffcore-delta.c
@@ -121,14 +121,15 @@ static int spanhash_cmp(const void *a_, const void *b_)
a->hashval > b->hashval ? 1 : 0;
}
-static struct spanhash_top *hash_chars(struct diff_filespec *one)
+static struct spanhash_top *hash_chars(struct repository *r,
+ struct diff_filespec *one)
{
int i, n;
unsigned int accum1, accum2, hashval;
struct spanhash_top *hash;
unsigned char *buf = one->data;
unsigned int sz = one->size;
- int is_text = !diff_filespec_is_binary(one);
+ int is_text = !diff_filespec_is_binary(r, one);
i = INITIAL_HASH_SIZE;
hash = xmalloc(st_add(sizeof(*hash),
@@ -162,7 +163,8 @@ static struct spanhash_top *hash_chars(struct diff_filespec *one)
return hash;
}
-int diffcore_count_changes(struct diff_filespec *src,
+int diffcore_count_changes(struct repository *r,
+ struct diff_filespec *src,
struct diff_filespec *dst,
void **src_count_p,
void **dst_count_p,
@@ -177,14 +179,14 @@ int diffcore_count_changes(struct diff_filespec *src,
if (src_count_p)
src_count = *src_count_p;
if (!src_count) {
- src_count = hash_chars(src);
+ src_count = hash_chars(r, src);
if (src_count_p)
*src_count_p = src_count;
}
if (dst_count_p)
dst_count = *dst_count_p;
if (!dst_count) {
- dst_count = hash_chars(dst);
+ dst_count = hash_chars(r, dst);
if (dst_count_p)
*dst_count_p = dst_count;
}