|
12 | 12 | #include "cache-tree.h"
|
13 | 13 | #include "parse-options.h"
|
14 | 14 | #include "entry.h"
|
| 15 | +#include "parallel-checkout.h" |
15 | 16 |
|
16 | 17 | #define CHECKOUT_ALL 4
|
17 | 18 | static int nul_term_line;
|
@@ -160,6 +161,7 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
|
160 | 161 | int prefix_length;
|
161 | 162 | int force = 0, quiet = 0, not_new = 0;
|
162 | 163 | int index_opt = 0;
|
| 164 | + int pc_workers, pc_threshold; |
163 | 165 | struct option builtin_checkout_index_options[] = {
|
164 | 166 | OPT_BOOL('a', "all", &all,
|
165 | 167 | N_("check out all files in the index")),
|
@@ -214,6 +216,14 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
|
214 | 216 | hold_locked_index(&lock_file, LOCK_DIE_ON_ERROR);
|
215 | 217 | }
|
216 | 218 |
|
| 219 | + if (!to_tempfile) |
| 220 | + get_parallel_checkout_configs(&pc_workers, &pc_threshold); |
| 221 | + else |
| 222 | + pc_workers = 1; |
| 223 | + |
| 224 | + if (pc_workers > 1) |
| 225 | + init_parallel_checkout(); |
| 226 | + |
217 | 227 | /* Check out named files first */
|
218 | 228 | for (i = 0; i < argc; i++) {
|
219 | 229 | const char *arg = argv[i];
|
@@ -256,6 +266,12 @@ int cmd_checkout_index(int argc, const char **argv, const char *prefix)
|
256 | 266 | if (all)
|
257 | 267 | checkout_all(prefix, prefix_length);
|
258 | 268 |
|
| 269 | + if (pc_workers > 1) { |
| 270 | + /* Errors were already reported */ |
| 271 | + run_parallel_checkout(&state, pc_workers, pc_threshold, |
| 272 | + NULL, NULL); |
| 273 | + } |
| 274 | + |
259 | 275 | if (is_lock_file_locked(&lock_file) &&
|
260 | 276 | write_locked_index(&the_index, &lock_file, COMMIT_LOCK))
|
261 | 277 | die("Unable to write new index file");
|
|
0 commit comments