| 144 | } |
| 145 | |
| 146 | static void paths_and_oids_insert(struct hashmap *map, |
| 147 | const char *path, |
| 148 | const struct object_id *oid) |
| 149 | { |
| 150 | int hash = strhash(path); |
| 151 | struct path_and_oids_entry key; |
| 152 | struct path_and_oids_entry *entry; |
| 153 | |
| 154 | hashmap_entry_init(&key.ent, hash); |
| 155 | |
| 156 | /* use a shallow copy for the lookup */ |
| 157 | key.path = (char *)path; |
| 158 | oidset_init(&key.trees, 0); |
| 159 | |
| 160 | entry = hashmap_get_entry(map, &key, ent, NULL); |
| 161 | if (!entry) { |
| 162 | CALLOC_ARRAY(entry, 1); |
| 163 | hashmap_entry_init(&entry->ent, hash); |
| 164 | entry->path = xstrdup(key.path); |
| 165 | oidset_init(&entry->trees, 16); |
| 166 | hashmap_put(map, &entry->ent); |
| 167 | } |
| 168 | |
| 169 | oidset_insert(&entry->trees, oid); |
| 170 | } |
| 171 | |
| 172 | static void add_children_by_path(struct repository *r, |
| 173 | struct tree *tree, |
no test coverage detected