| 42 | static const int DEFAULT_NUM_WORKERS = 1; |
| 43 | |
| 44 | void get_parallel_checkout_configs(int *num_workers, int *threshold) |
| 45 | { |
| 46 | char *env_workers = getenv("GIT_TEST_CHECKOUT_WORKERS"); |
| 47 | |
| 48 | if (env_workers && *env_workers) { |
| 49 | if (strtol_i(env_workers, 10, num_workers)) { |
| 50 | die(_("invalid value for '%s': '%s'"), |
| 51 | "GIT_TEST_CHECKOUT_WORKERS", env_workers); |
| 52 | } |
| 53 | if (*num_workers < 1) |
| 54 | *num_workers = online_cpus(); |
| 55 | |
| 56 | *threshold = 0; |
| 57 | return; |
| 58 | } |
| 59 | |
| 60 | if (repo_config_get_int(the_repository, "checkout.workers", num_workers)) |
| 61 | *num_workers = DEFAULT_NUM_WORKERS; |
| 62 | else if (*num_workers < 1) |
| 63 | *num_workers = online_cpus(); |
| 64 | |
| 65 | if (repo_config_get_int(the_repository, "checkout.thresholdForParallelism", threshold)) |
| 66 | *threshold = DEFAULT_THRESHOLD_FOR_PARALLELISM; |
| 67 | } |
| 68 | |
| 69 | void init_parallel_checkout(void) |
| 70 | { |
no test coverage detected