restore fetching with thin-pack capability
[git.git] / entry.c
diff --git a/entry.c b/entry.c
index 98f5f6d4ecfc0dabae9a920bdf3beadbf20abcaf..cfadc6a292033d349f6b1efff75d2c4f9f2525fe 100644 (file)
--- a/entry.c
+++ b/entry.c
@@ -119,8 +119,10 @@ static int write_entry(struct cache_entry *ce, char *path, const struct checkout
                 */
                strbuf_init(&buf, 0);
                if (convert_to_working_tree(ce->name, new, size, &buf)) {
+                       size_t newsize = 0;
                        free(new);
-                       new = strbuf_detach(&buf, &size);
+                       new = strbuf_detach(&buf, &newsize);
+                       size = newsize;
                }
 
                if (to_tempfile) {