| 173 | } |
| 174 | |
| 175 | int finish_delayed_checkout(struct checkout *state, int show_progress) |
| 176 | { |
| 177 | int errs = 0; |
| 178 | unsigned processed_paths = 0; |
| 179 | off_t filtered_bytes = 0; |
| 180 | struct string_list_item *filter, *path; |
| 181 | struct progress *progress = NULL; |
| 182 | struct delayed_checkout *dco = state->delayed_checkout; |
| 183 | |
| 184 | if (!state->delayed_checkout) |
| 185 | return errs; |
| 186 | |
| 187 | dco->state = CE_RETRY; |
| 188 | if (show_progress) |
| 189 | progress = start_delayed_progress(the_repository, |
| 190 | _("Filtering content"), |
| 191 | dco->paths.nr); |
| 192 | while (dco->filters.nr > 0) { |
| 193 | for_each_string_list_item(filter, &dco->filters) { |
| 194 | struct string_list available_paths = STRING_LIST_INIT_DUP; |
| 195 | |
| 196 | if (!async_query_available_blobs(filter->string, &available_paths)) { |
| 197 | /* Filter reported an error */ |
| 198 | errs = 1; |
| 199 | filter->string = NULL; |
| 200 | continue; |
| 201 | } |
| 202 | if (available_paths.nr <= 0) { |
| 203 | /* |
| 204 | * Filter responded with no entries. That means |
| 205 | * the filter is done and we can remove the |
| 206 | * filter from the list (see |
| 207 | * "string_list_remove_empty_items" call below). |
| 208 | */ |
| 209 | filter->string = NULL; |
| 210 | continue; |
| 211 | } |
| 212 | |
| 213 | /* |
| 214 | * In dco->paths we store a list of all delayed paths. |
| 215 | * The filter just send us a list of available paths. |
| 216 | * Remove them from the list. |
| 217 | */ |
| 218 | filter_string_list(&dco->paths, 0, |
| 219 | &remove_available_paths, &available_paths); |
| 220 | |
| 221 | for_each_string_list_item(path, &available_paths) { |
| 222 | struct cache_entry* ce; |
| 223 | |
| 224 | if (!path->util) { |
| 225 | error("external filter '%s' signaled that '%s' " |
| 226 | "is now available although it has not been " |
| 227 | "delayed earlier", |
| 228 | filter->string, path->string); |
| 229 | errs |= 1; |
| 230 | |
| 231 | /* |
| 232 | * Do not ask the filter for available blobs, |
no test coverage detected