summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/sha1_file.c b/sha1_file.c
index aea1096..64b5b46 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -2343,12 +2343,12 @@ int index_fd(unsigned char *sha1, int fd, struct stat *st, int write_object,
* Convert blobs to git internal format
*/
if ((type == OBJ_BLOB) && S_ISREG(st->st_mode)) {
- unsigned long nsize = size;
- char *nbuf = convert_to_git(path, buf, &nsize);
- if (nbuf) {
+ struct strbuf nbuf;
+ strbuf_init(&nbuf, 0);
+ if (convert_to_git(path, buf, size, &nbuf)) {
munmap(buf, size);
- size = nsize;
- buf = nbuf;
+ size = nbuf.len;
+ buf = nbuf.buf;
re_allocated = 1;
}
}