| 144 | } |
| 145 | |
| 146 | static int odb_source_inmemory_for_each_object(struct odb_source *source, |
| 147 | const struct object_info *request, |
| 148 | odb_for_each_object_cb cb, |
| 149 | void *cb_data, |
| 150 | const struct odb_for_each_object_options *opts) |
| 151 | { |
| 152 | struct odb_source_inmemory *inmemory = odb_source_inmemory_downcast(source); |
| 153 | struct odb_source_inmemory_for_each_object_data payload = { |
| 154 | .inmemory = inmemory, |
| 155 | .request = request, |
| 156 | .cb = cb, |
| 157 | .cb_data = cb_data, |
| 158 | }; |
| 159 | struct object_id null_oid = { 0 }; |
| 160 | |
| 161 | if ((opts->flags & ODB_FOR_EACH_OBJECT_PROMISOR_ONLY) || |
| 162 | (opts->flags & ODB_FOR_EACH_OBJECT_LOCAL_ONLY && !source->local)) |
| 163 | return 0; |
| 164 | if (!inmemory->objects) |
| 165 | return 0; |
| 166 | |
| 167 | return oidtree_each(inmemory->objects, |
| 168 | opts->prefix ? opts->prefix : &null_oid, opts->prefix_hex_len, |
| 169 | odb_source_inmemory_for_each_object_cb, &payload); |
| 170 | } |
| 171 | |
| 172 | struct find_abbrev_len_data { |
| 173 | const struct object_id *oid; |
no test coverage detected