shallow: rewrite functions to take object_id arguments
[gitweb.git] / bulk-checkin.c
index 8d157eba455f15a00cc7bf9b970f1862167ee1bb..7cffc3a579e4a02c1422284092cef18cd4b7d059 100644 (file)
@@ -24,7 +24,7 @@ static struct bulk_checkin_state {
 
 static void finish_bulk_checkin(struct bulk_checkin_state *state)
 {
-       unsigned char sha1[20];
+       struct object_id oid;
        struct strbuf packname = STRBUF_INIT;
        int i;
 
@@ -36,11 +36,11 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)
                unlink(state->pack_tmp_name);
                goto clear_exit;
        } else if (state->nr_written == 1) {
-               sha1close(state->f, sha1, CSUM_FSYNC);
+               sha1close(state->f, oid.hash, CSUM_FSYNC);
        } else {
-               int fd = sha1close(state->f, sha1, 0);
-               fixup_pack_header_footer(fd, sha1, state->pack_tmp_name,
-                                        state->nr_written, sha1,
+               int fd = sha1close(state->f, oid.hash, 0);
+               fixup_pack_header_footer(fd, oid.hash, state->pack_tmp_name,
+                                        state->nr_written, oid.hash,
                                         state->offset);
                close(fd);
        }
@@ -48,7 +48,7 @@ static void finish_bulk_checkin(struct bulk_checkin_state *state)
        strbuf_addf(&packname, "%s/pack/pack-", get_object_directory());
        finish_tmp_packfile(&packname, state->pack_tmp_name,
                            state->written, state->nr_written,
-                           &state->pack_idx_opts, sha1);
+                           &state->pack_idx_opts, oid.hash);
        for (i = 0; i < state->nr_written; i++)
                free(state->written[i]);