userdiff.c: remove implicit dependency on the_index
[jc: squashed in missing forward decl in userdiff.h found by Ramsay] Helped-by: Ramsay Jones <ramsay@ramsayjones.plus.com> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
35843b1123
commit
acd00ea049
@ -264,9 +264,10 @@ static int has_only_ascii(const char *s)
|
||||
}
|
||||
}
|
||||
|
||||
static int entry_is_binary(const char *path, const void *buffer, size_t size)
|
||||
static int entry_is_binary(struct index_state *istate, const char *path,
|
||||
const void *buffer, size_t size)
|
||||
{
|
||||
struct userdiff_driver *driver = userdiff_find_by_path(path);
|
||||
struct userdiff_driver *driver = userdiff_find_by_path(istate, path);
|
||||
if (!driver)
|
||||
driver = userdiff_find_by_name("default");
|
||||
if (driver->binary != -1)
|
||||
@ -352,7 +353,8 @@ static int write_zip_entry(struct archiver_args *args,
|
||||
return error(_("cannot read %s"),
|
||||
oid_to_hex(oid));
|
||||
crc = crc32(crc, buffer, size);
|
||||
is_binary = entry_is_binary(path_without_prefix,
|
||||
is_binary = entry_is_binary(args->repo->index,
|
||||
path_without_prefix,
|
||||
buffer, size);
|
||||
out = buffer;
|
||||
}
|
||||
@ -428,7 +430,8 @@ static int write_zip_entry(struct archiver_args *args,
|
||||
break;
|
||||
crc = crc32(crc, buf, readlen);
|
||||
if (is_binary == -1)
|
||||
is_binary = entry_is_binary(path_without_prefix,
|
||||
is_binary = entry_is_binary(args->repo->index,
|
||||
path_without_prefix,
|
||||
buf, readlen);
|
||||
write_or_die(1, buf, readlen);
|
||||
}
|
||||
@ -460,7 +463,8 @@ static int write_zip_entry(struct archiver_args *args,
|
||||
break;
|
||||
crc = crc32(crc, buf, readlen);
|
||||
if (is_binary == -1)
|
||||
is_binary = entry_is_binary(path_without_prefix,
|
||||
is_binary = entry_is_binary(args->repo->index,
|
||||
path_without_prefix,
|
||||
buf, readlen);
|
||||
|
||||
zstream.next_in = buf;
|
||||
|
Reference in New Issue
Block a user