}
int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
- enum object_type type)
+ enum object_type type, const char *path)
{
unsigned long size = st->st_size;
void *buf;
/*
* Convert blobs to git internal format
*/
- if (type == OBJ_BLOB) {
+ if ((type == OBJ_BLOB) && S_ISREG(st->st_mode)) {
unsigned long nsize = size;
char *nbuf = buf;
- if (convert_to_git(NULL, &nbuf, &nsize)) {
+ if (convert_to_git(path, &nbuf, &nsize)) {
if (size)
munmap(buf, size);
size = nsize;
if (fd < 0)
return error("open(\"%s\"): %s", path,
strerror(errno));
- if (index_fd(sha1, fd, st, write_object, OBJ_BLOB) < 0)
+ if (index_fd(sha1, fd, st, write_object, OBJ_BLOB, path) < 0)
return error("%s: failed to insert into database",
path);
break;