- hdrlen = sprintf(hdr, "blob %lu", datlen) + 1;
- SHA1_Init(&c);
- SHA1_Update(&c, hdr, hdrlen);
- SHA1_Update(&c, dat, datlen);
- SHA1_Final(sha1, &c);
-
- e = insert_object(sha1);
- if (!e->offset) {
- e->offset = packoff;
- write_blob(dat, datlen);
- object_count++;
-
- if (lastdat)
- free(lastdat);
- lastdat = dat;
- lastdatlen = datlen;
- memcpy(lastsha1, sha1, sizeof(sha1));
- } else {
- duplicate_count++;
+ if (!store_object(OBJ_BLOB, dat, datlen, &last_blob))