Skip to content

Commit 8a5d4bd

Browse files
ttaylorrgitster
authored andcommitted
builtin/repack.c: avoid using hash_to_hex() in pack geometry
In previous commits, we started passing either repository or git_hash_algo pointers around to various spots within builtin/repack.c to reduce our dependency on the_repository in the hope of undef'ing USE_THE_REPOSITORY_VARIABLE. This commit takes us as far as we can (easily) go in that direction by removing the only use of a convenience function that only exists when USE_THE_REPOSITORY_VARIABLE is defined. Unfortunately, the only other such function is "is_bare_repository()", which is less than straightforward to convert into, say, "repo_is_bare()", the latter of the two accepting a repository pointer. Punt on that for now, and declare this commit as the stopping point for our efforts in the direction of undef'ing USE_THE_REPOSITORY_VARIABLE. Signed-off-by: Taylor Blau <me@ttaylorr.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent c660b0d commit 8a5d4bd

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

builtin/repack.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -683,12 +683,14 @@ static void geometry_remove_redundant_packs(struct pack_geometry *geometry,
683683
struct string_list *names,
684684
struct existing_packs *existing)
685685
{
686+
const struct git_hash_algo *algop = existing->repo->hash_algo;
686687
struct strbuf buf = STRBUF_INIT;
687688
uint32_t i;
688689

689690
for (i = 0; i < geometry->split; i++) {
690691
struct packed_git *p = geometry->pack[i];
691-
if (string_list_has_string(names, hash_to_hex(p->hash)))
692+
if (string_list_has_string(names, hash_to_hex_algop(p->hash,
693+
algop)))
692694
continue;
693695

694696
strbuf_reset(&buf);

0 commit comments

Comments
 (0)