sequencer: remember the onelines when parsing the todo file
[gitweb.git] / streaming.c
index 811fcc24d2a8ba56c233ae4e37b7acac29a4a0d8..3f017a1c058fb94bc3220be09c384e53e565fb40 100644 (file)
@@ -337,17 +337,17 @@ static open_method_decl(loose)
        st->u.loose.mapped = map_sha1_file(sha1, &st->u.loose.mapsize);
        if (!st->u.loose.mapped)
                return -1;
-       if (unpack_sha1_header(&st->z,
-                              st->u.loose.mapped,
-                              st->u.loose.mapsize,
-                              st->u.loose.hdr,
-                              sizeof(st->u.loose.hdr)) < 0) {
+       if ((unpack_sha1_header(&st->z,
+                               st->u.loose.mapped,
+                               st->u.loose.mapsize,
+                               st->u.loose.hdr,
+                               sizeof(st->u.loose.hdr)) < 0) ||
+           (parse_sha1_header(st->u.loose.hdr, &st->size) < 0)) {
                git_inflate_end(&st->z);
                munmap(st->u.loose.mapped, st->u.loose.mapsize);
                return -1;
        }
 
-       parse_sha1_header(st->u.loose.hdr, &st->size);
        st->u.loose.hdr_used = strlen(st->u.loose.hdr) + 1;
        st->u.loose.hdr_avail = st->z.total_out;
        st->z_state = z_used;
@@ -497,7 +497,7 @@ static open_method_decl(incore)
  * Users of streaming interface
  ****************************************************************/
 
-int stream_blob_to_fd(int fd, unsigned const char *sha1, struct stream_filter *filter,
+int stream_blob_to_fd(int fd, const struct object_id *oid, struct stream_filter *filter,
                      int can_seek)
 {
        struct git_istream *st;
@@ -506,7 +506,7 @@ int stream_blob_to_fd(int fd, unsigned const char *sha1, struct stream_filter *f
        ssize_t kept = 0;
        int result = -1;
 
-       st = open_istream(sha1, &type, &sz, filter);
+       st = open_istream(oid->hash, &type, &sz, filter);
        if (!st) {
                if (filter)
                        free_stream_filter(filter);