refspec: convert valid_fetch_refspec to use parse_refspec
[gitweb.git] / builtin / unpack-file.c
index 281ca1db6ce13ddb4cc227ebb7ea454176e8e9e1..300eb59657e29cace38798029a9170834cac7c9e 100644 (file)
@@ -9,13 +9,13 @@ static char *create_temp_file(struct object_id *oid)
        unsigned long size;
        int fd;
 
-       buf = read_sha1_file(oid->hash, &type, &size);
+       buf = read_object_file(oid, &type, &size);
        if (!buf || type != OBJ_BLOB)
                die("unable to read blob object %s", oid_to_hex(oid));
 
        xsnprintf(path, sizeof(path), ".merge_file_XXXXXX");
        fd = xmkstemp(path);
-       if (write_in_full(fd, buf, size) != size)
+       if (write_in_full(fd, buf, size) < 0)
                die_errno("unable to write temp-file");
        close(fd);
        return path;