]> git.ipfire.org Git - thirdparty/git.git/blobdiff - parallel-checkout.c
config API users: test for *_get_value_multi() segfaults
[thirdparty/git.git] / parallel-checkout.c
index 8dd7e7bad404321856c43cfcbe9a7fbab4fd9ebe..4f6819f2406ea8f90651b7769cbaf1758ce4c098 100644 (file)
@@ -39,8 +39,8 @@ void get_parallel_checkout_configs(int *num_workers, int *threshold)
 
        if (env_workers && *env_workers) {
                if (strtol_i(env_workers, 10, num_workers)) {
-                       die("invalid value for GIT_TEST_CHECKOUT_WORKERS: '%s'",
-                           env_workers);
+                       die(_("invalid value for '%s': '%s'"),
+                           "GIT_TEST_CHECKOUT_WORKERS", env_workers);
                }
                if (*num_workers < 1)
                        *num_workers = online_cpus();
@@ -143,7 +143,8 @@ static int is_eligible_for_parallel_checkout(const struct cache_entry *ce,
        }
 }
 
-int enqueue_checkout(struct cache_entry *ce, struct conv_attrs *ca)
+int enqueue_checkout(struct cache_entry *ce, struct conv_attrs *ca,
+                    int *checkout_counter)
 {
        struct parallel_checkout_item *pc_item;
 
@@ -159,6 +160,7 @@ int enqueue_checkout(struct cache_entry *ce, struct conv_attrs *ca)
        memcpy(&pc_item->ca, ca, sizeof(pc_item->ca));
        pc_item->status = PC_ITEM_PENDING;
        pc_item->id = parallel_checkout.nr;
+       pc_item->checkout_counter = checkout_counter;
        parallel_checkout.nr++;
 
        return 0;
@@ -200,7 +202,8 @@ static int handle_results(struct checkout *state)
 
                switch(pc_item->status) {
                case PC_ITEM_WRITTEN:
-                       /* Already handled */
+                       if (pc_item->checkout_counter)
+                               (*pc_item->checkout_counter)++;
                        break;
                case PC_ITEM_COLLIDED:
                        /*
@@ -225,7 +228,8 @@ static int handle_results(struct checkout *state)
                         * add any extra overhead.
                         */
                        ret |= checkout_entry_ca(pc_item->ce, &pc_item->ca,
-                                                state, NULL, NULL);
+                                                state, NULL,
+                                                pc_item->checkout_counter);
                        advance_progress_meter();
                        break;
                case PC_ITEM_PENDING: