| 102 | } |
| 103 | |
| 104 | static void submodule_cache_clear(struct submodule_cache *cache) |
| 105 | { |
| 106 | struct hashmap_iter iter; |
| 107 | struct submodule_entry *entry; |
| 108 | |
| 109 | if (!cache->initialized) |
| 110 | return; |
| 111 | |
| 112 | /* |
| 113 | * We iterate over the name hash here to be symmetric with the |
| 114 | * allocation of struct submodule entries. Each is allocated by |
| 115 | * their .gitmodules blob sha1 and submodule name. |
| 116 | */ |
| 117 | hashmap_for_each_entry(&cache->for_name, &iter, entry, |
| 118 | ent /* member name */) |
| 119 | free_one_config(entry); |
| 120 | |
| 121 | hashmap_clear_and_free(&cache->for_path, struct submodule_entry, ent); |
| 122 | hashmap_clear_and_free(&cache->for_name, struct submodule_entry, ent); |
| 123 | cache->initialized = 0; |
| 124 | cache->gitmodules_read = 0; |
| 125 | } |
| 126 | |
| 127 | void submodule_cache_free(struct submodule_cache *cache) |
| 128 | { |
no test coverage detected