Merge branch 'jk/oidhash'

Code clean-up to remove hardcoded SHA-1 hash from many places.

* jk/oidhash:
  hashmap: convert sha1hash() to oidhash()
  hash.h: move object_id definition from cache.h
  khash: rename oid helper functions
  khash: drop sha1-specific map types
  pack-bitmap: convert khash_sha1 maps into kh_oid_map
  delta-islands: convert island_marks khash to use oids
  khash: rename kh_oid_t to kh_oid_set
  khash: drop broken oid_map typedef
  object: convert create_object() to use object_id
  object: convert internal hash_obj() to object_id
  object: convert lookup_object() to use object_id
  object: convert lookup_unknown_object() to use object_id
  pack-objects: convert locate_object_entry_hash() to object_id
  pack-objects: convert packlist_find() to use object_id
  pack-bitmap-write: convert some helpers to use object_id
  upload-pack: rename a "sha1" variable to "oid"
  describe: fix accidental oid/hash type-punning
This commit is contained in:
Junio C Hamano
2019-07-09 15:25:43 -07:00
37 changed files with 156 additions and 168 deletions

View File

@ -528,13 +528,13 @@ static int get_reachable_list(struct object_array *src,
return -1;
while ((i = read_in_full(cmd.out, namebuf, hexsz + 1)) == hexsz + 1) {
struct object_id sha1;
struct object_id oid;
const char *p;
if (parse_oid_hex(namebuf, &sha1, &p) || *p != '\n')
if (parse_oid_hex(namebuf, &oid, &p) || *p != '\n')
break;
o = lookup_object(the_repository, sha1.hash);
o = lookup_object(the_repository, &oid);
if (o && o->type == OBJ_COMMIT) {
o->flags &= ~TMP_MARK;
}
@ -960,7 +960,7 @@ static void receive_needs(struct packet_reader *reader, struct object_array *wan
static int mark_our_ref(const char *refname, const char *refname_full,
const struct object_id *oid)
{
struct object *o = lookup_unknown_object(oid->hash);
struct object *o = lookup_unknown_object(oid);
if (ref_is_hidden(refname, refname_full)) {
o->flags |= HIDDEN_REF;