diff options
author | Vincent Ambo <tazjin@google.com> | 2020-05-25T23·06+0100 |
---|---|---|
committer | Vincent Ambo <tazjin@google.com> | 2020-05-25T23·06+0100 |
commit | 93ba78d6f4632ef1c5228965e3edc8c0faf88c1e (patch) | |
tree | 85730c182a9f5f492ade8e8ccdb1c2356f9900bd /third_party/git/refs.c | |
parent | 6f8fbf4aa4b1654ab27d4829e114538761817de0 (diff) |
revert(3p/git): Revert merge of git upstream at v2.26.2 r/852
This causes cgit to serve error pages, which is undesirable. This reverts commit 5229c9b232de5bfa959ad6ebbb4c8192ac513352, reversing changes made to f2b211131f2347342dde63975b09cf603149f1a3.
Diffstat (limited to 'third_party/git/refs.c')
-rw-r--r-- | third_party/git/refs.c | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/third_party/git/refs.c b/third_party/git/refs.c index 1ab0bb54d3d7..cd297ee4bdbe 100644 --- a/third_party/git/refs.c +++ b/third_party/git/refs.c @@ -1772,7 +1772,7 @@ int resolve_gitlink_ref(const char *submodule, const char *refname, struct ref_store_hash_entry { - struct hashmap_entry ent; + struct hashmap_entry ent; /* must be the first member! */ struct ref_store *refs; @@ -1781,16 +1781,11 @@ struct ref_store_hash_entry }; static int ref_store_hash_cmp(const void *unused_cmp_data, - const struct hashmap_entry *eptr, - const struct hashmap_entry *entry_or_key, + const void *entry, const void *entry_or_key, const void *keydata) { - const struct ref_store_hash_entry *e1, *e2; - const char *name; - - e1 = container_of(eptr, const struct ref_store_hash_entry, ent); - e2 = container_of(entry_or_key, const struct ref_store_hash_entry, ent); - name = keydata ? keydata : e2->name; + const struct ref_store_hash_entry *e1 = entry, *e2 = entry_or_key; + const char *name = keydata ? keydata : e2->name; return strcmp(e1->name, name); } @@ -1801,7 +1796,7 @@ static struct ref_store_hash_entry *alloc_ref_store_hash_entry( struct ref_store_hash_entry *entry; FLEX_ALLOC_STR(entry, name, name); - hashmap_entry_init(&entry->ent, strhash(name)); + hashmap_entry_init(entry, strhash(name)); entry->refs = refs; return entry; } @@ -1820,15 +1815,12 @@ static struct ref_store *lookup_ref_store_map(struct hashmap *map, const char *name) { struct ref_store_hash_entry *entry; - unsigned int hash; if (!map->tablesize) /* It's initialized on demand in register_ref_store(). */ return NULL; - hash = strhash(name); - entry = hashmap_get_entry_from_hash(map, hash, name, - struct ref_store_hash_entry, ent); + entry = hashmap_get_from_hash(map, strhash(name), name); return entry ? entry->refs : NULL; } @@ -1871,13 +1863,10 @@ static void register_ref_store_map(struct hashmap *map, struct ref_store *refs, const char *name) { - struct ref_store_hash_entry *entry; - if (!map->tablesize) hashmap_init(map, ref_store_hash_cmp, NULL, 0); - entry = alloc_ref_store_hash_entry(name, refs); - if (hashmap_put(map, &entry->ent)) + if (hashmap_put(map, alloc_ref_store_hash_entry(name, refs))) BUG("%s ref_store '%s' initialized twice", type, name); } |