curr_index = write_idx_file(the_hash_algo, index_name, idx_objects,
nr_objects, &opts, pack_hash);
if (rev_index)
- curr_rev_index = write_rev_file(rev_index_name, idx_objects,
- nr_objects, pack_hash,
- opts.flags);
+ curr_rev_index = write_rev_file(the_hash_algo, rev_index_name,
+ idx_objects, nr_objects,
+ pack_hash, opts.flags);
free(idx_objects);
if (!verify)
strbuf_addf(&buf, "%s-%s.rev", midx_name, hash_to_hex_algop(midx_hash,
ctx->repo->hash_algo));
- tmp_file = write_rev_file_order(NULL, ctx->pack_order, ctx->entries_nr,
- midx_hash, WRITE_REV);
+ tmp_file = write_rev_file_order(ctx->repo->hash_algo, NULL, ctx->pack_order,
+ ctx->entries_nr, midx_hash, WRITE_REV);
if (finalize_object_file(tmp_file, buf.buf))
die(_("cannot store reverse index file"));
return 0;
}
-static void write_rev_header(struct hashfile *f)
+static void write_rev_header(const struct git_hash_algo *hash_algo,
+ struct hashfile *f)
{
hashwrite_be32(f, RIDX_SIGNATURE);
hashwrite_be32(f, RIDX_VERSION);
- hashwrite_be32(f, oid_version(the_hash_algo));
+ hashwrite_be32(f, oid_version(hash_algo));
}
static void write_rev_index_positions(struct hashfile *f,
hashwrite(f, hash, the_hash_algo->rawsz);
}
-char *write_rev_file(const char *rev_name,
+char *write_rev_file(const struct git_hash_algo *hash_algo,
+ const char *rev_name,
struct pack_idx_entry **objects,
uint32_t nr_objects,
const unsigned char *hash,
pack_order[i] = i;
QSORT_S(pack_order, nr_objects, pack_order_cmp, objects);
- ret = write_rev_file_order(rev_name, pack_order, nr_objects, hash,
- flags);
+ ret = write_rev_file_order(hash_algo, rev_name, pack_order, nr_objects,
+ hash, flags);
free(pack_order);
return ret;
}
-char *write_rev_file_order(const char *rev_name,
+char *write_rev_file_order(const struct git_hash_algo *hash_algo,
+ const char *rev_name,
uint32_t *pack_order,
uint32_t nr_objects,
const unsigned char *hash,
return NULL;
}
- write_rev_header(f);
+ write_rev_header(hash_algo, f);
write_rev_index_positions(f, pack_order, nr_objects);
write_rev_trailer(f, hash);
if (adjust_shared_perm(*idx_tmp_name))
die_errno("unable to make temporary index file readable");
- rev_tmp_name = write_rev_file(NULL, written_list, nr_written, hash,
- pack_idx_opts->flags);
+ rev_tmp_name = write_rev_file(hash_algo, NULL, written_list, nr_written,
+ hash, pack_idx_opts->flags);
if (pack_idx_opts->flags & WRITE_MTIMES) {
mtimes_tmp_name = write_mtimes_file(to_pack, written_list,
void write_promisor_file(const char *promisor_name, struct ref **sought, int nr_sought);
-char *write_rev_file(const char *rev_name, struct pack_idx_entry **objects, uint32_t nr_objects, const unsigned char *hash, unsigned flags);
-char *write_rev_file_order(const char *rev_name, uint32_t *pack_order, uint32_t nr_objects, const unsigned char *hash, unsigned flags);
+char *write_rev_file(const struct git_hash_algo *hash_algo,
+ const char *rev_name,
+ struct pack_idx_entry **objects,
+ uint32_t nr_objects,
+ const unsigned char *hash,
+ unsigned flags);
+char *write_rev_file_order(const struct git_hash_algo *hash_algo,
+ const char *rev_name,
+ uint32_t *pack_order,
+ uint32_t nr_objects,
+ const unsigned char *hash,
+ unsigned flags);
/*
* The "hdr" output buffer should be at least this big, which will handle sizes