MCPcopy Create free account
hub / github.com/git/git / paths_and_oids_insert

Function paths_and_oids_insert

revision.c:146–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

144}
145
146static 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
172static void add_children_by_path(struct repository *r,
173 struct tree *tree,

Callers 1

add_children_by_pathFunction · 0.85

Calls 6

strhashFunction · 0.85
hashmap_entry_initFunction · 0.85
oidset_initFunction · 0.85
xstrdupFunction · 0.85
hashmap_putFunction · 0.85
oidset_insertFunction · 0.85

Tested by

no test coverage detected