| 891 | } |
| 892 | |
| 893 | int fetch_bundle_list(struct repository *r, struct bundle_list *list) |
| 894 | { |
| 895 | int result; |
| 896 | struct bundle_list global_list; |
| 897 | |
| 898 | /* |
| 899 | * If the creationToken heuristic is used, then the URIs |
| 900 | * advertised by 'list' are not nested lists and instead |
| 901 | * direct bundles. We do not need to use global_list. |
| 902 | */ |
| 903 | if (list->heuristic == BUNDLE_HEURISTIC_CREATIONTOKEN) |
| 904 | return fetch_bundles_by_token(r, list); |
| 905 | |
| 906 | init_bundle_list(&global_list); |
| 907 | |
| 908 | /* If a bundle is added to this global list, then it is required. */ |
| 909 | global_list.mode = BUNDLE_MODE_ALL; |
| 910 | |
| 911 | if ((result = download_bundle_list(r, list, &global_list, 0))) |
| 912 | goto cleanup; |
| 913 | |
| 914 | if (list->heuristic == BUNDLE_HEURISTIC_CREATIONTOKEN) |
| 915 | result = fetch_bundles_by_token(r, list); |
| 916 | else |
| 917 | result = unbundle_all_bundles(r, &global_list); |
| 918 | |
| 919 | cleanup: |
| 920 | for_all_bundles_in_list(&global_list, unlink_bundle, NULL); |
| 921 | clear_bundle_list(&global_list); |
| 922 | return result; |
| 923 | } |
| 924 | |
| 925 | /** |
| 926 | * API for serve.c. |
no test coverage detected