Add several uses of get_object_hash.
[gitweb.git] / builtin / index-pack.c
index 3431de2362d981b1239d8269d17fb75d8de094fd..b01a8c0e227c7fec7c5456aa9e29972682ac6819 100644 (file)
@@ -217,7 +217,7 @@ static unsigned check_object(struct object *obj)
 
        if (!(obj->flags & FLAG_CHECKED)) {
                unsigned long size;
-               int type = sha1_object_info(obj->sha1, &size);
+               int type = sha1_object_info(get_object_hash(*obj), &size);
                if (type <= 0)
                        die(_("did not receive expected object %s"),
                              sha1_to_hex(obj->sha1));
@@ -441,7 +441,7 @@ static void *unpack_entry_data(unsigned long offset, unsigned long size,
        int hdrlen;
 
        if (!is_delta_type(type)) {
-               hdrlen = sprintf(hdr, "%s %lu", typename(type), size) + 1;
+               hdrlen = xsnprintf(hdr, sizeof(hdr), "%s %lu", typename(type), size) + 1;
                git_SHA1_Init(&c);
                git_SHA1_Update(&c, hdr, hdrlen);
        } else