Merge branch 'jk/use-oid-pos'

Code clean-up to ensure our use of hashtables using object names as
keys use the "struct object_id" objects, not the raw hash values.

* jk/use-oid-pos:
  oid_pos(): access table through const pointers
  hash_pos(): convert to oid_pos()
  rerere: use strmap to store rerere directories
  rerere: tighten rr-cache dirname check
  rerere: check dirname format while iterating rr_cache directory
  commit_graft_pos(): take an oid instead of a bare hash
This commit is contained in:
Junio C Hamano
2021-02-10 14:48:31 -08:00
10 changed files with 85 additions and 92 deletions

View File

@ -390,10 +390,10 @@ static void name_tips(void)
}
}
static const unsigned char *nth_tip_table_ent(size_t ix, void *table_)
static const struct object_id *nth_tip_table_ent(size_t ix, const void *table_)
{
struct tip_table_entry *table = table_;
return table[ix].oid.hash;
const struct tip_table_entry *table = table_;
return &table[ix].oid;
}
static const char *get_exact_ref_match(const struct object *o)
@ -408,8 +408,8 @@ static const char *get_exact_ref_match(const struct object *o)
tip_table.sorted = 1;
}
found = hash_pos(o->oid.hash, tip_table.table, tip_table.nr,
nth_tip_table_ent);
found = oid_pos(&o->oid, tip_table.table, tip_table.nr,
nth_tip_table_ent);
if (0 <= found)
return tip_table.table[found].refname;
return NULL;