]> asedeno.scripts.mit.edu Git - git.git/blobdiff - sha1_file.c
Drop strbuf's 'eof' marker, and make read_line a first class citizen.
[git.git] / sha1_file.c
index aea10961fdd9ba6e14514701a49bd69cb594a695..59325d46bec1ec604e65f9e5414cd75bba929c63 100644 (file)
@@ -14,7 +14,6 @@
 #include "tag.h"
 #include "tree.h"
 #include "refs.h"
-#include "strbuf.h"
 
 #ifndef O_NOATIME
 #if defined(__linux__) && (defined(__i386__) || defined(__PPC__))
@@ -2343,12 +2342,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;
                }
        }