Merge branch 'maint'
* maint: Documentation/gitdiffcore: fix order in pickaxe description Documentation: fix minor inconsistency Documentation: rebase -i ignores options passed to "git am" hash_object: correction for zero length file
This commit is contained in:
@ -2448,6 +2448,8 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
|
||||
else
|
||||
ret = -1;
|
||||
strbuf_release(&sbuf);
|
||||
} else if (!size) {
|
||||
ret = index_mem(sha1, NULL, size, write_object, type, path);
|
||||
} else if (size <= SMALL_FILE_SIZE) {
|
||||
char *buf = xmalloc(size);
|
||||
if (size == read_in_full(fd, buf, size))
|
||||
@ -2456,12 +2458,11 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
|
||||
else
|
||||
ret = error("short read %s", strerror(errno));
|
||||
free(buf);
|
||||
} else if (size) {
|
||||
} else {
|
||||
void *buf = xmmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0);
|
||||
ret = index_mem(sha1, buf, size, write_object, type, path);
|
||||
munmap(buf, size);
|
||||
} else
|
||||
ret = index_mem(sha1, NULL, size, write_object, type, path);
|
||||
}
|
||||
close(fd);
|
||||
return ret;
|
||||
}
|
||||
|
Reference in New Issue
Block a user