int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
enum object_type type, const char *path)
enum object_type type, const char *path, int format_check)
{
int ret;
size_t size = xsize_t(st->st_size);
@ -2520,23 +2558,25 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
@@ -2520,23 +2558,25 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
struct strbuf sbuf = STRBUF_INIT;
if (strbuf_read(&sbuf, fd, 4096) >= 0)
ret = index_mem(sha1, sbuf.buf, sbuf.len, write_object,
type, path);
type, path, format_check);
else
ret = -1;
strbuf_release(&sbuf);
} else if (!size) {
ret = index_mem(sha1, NULL, size, write_object, type, path);
ret = index_mem(sha1, NULL, size, write_object, type, path,
format_check);
} else if (size <= SMALL_FILE_SIZE) {
char *buf = xmalloc(size);
if (size == read_in_full(fd, buf, size))
ret = index_mem(sha1, buf, size, write_object, type,