repository: repo_submodule_init to take a submodule struct
[gitweb.git] / preload-index.c
index 0e24886aca9f052fec844859cdf84d6229f83137..c7dc3f2b9f62a762efd7f590d6e8959fc1707479 100644 (file)
@@ -90,9 +90,9 @@ static void *preload_thread(void *_data)
        return NULL;
 }
 
-static void preload_index(struct index_state *index,
-                         const struct pathspec *pathspec,
-                         unsigned int refresh_flags)
+void preload_index(struct index_state *index,
+                  const struct pathspec *pathspec,
+                  unsigned int refresh_flags)
 {
        int threads, i, work, offset;
        struct thread_data data[MAX_PARALLEL];
@@ -121,6 +121,8 @@ static void preload_index(struct index_state *index,
 
        for (i = 0; i < threads; i++) {
                struct thread_data *p = data+i;
+               int err;
+
                p->index = index;
                if (pathspec)
                        copy_pathspec(&p->pathspec, pathspec);
@@ -129,8 +131,10 @@ static void preload_index(struct index_state *index,
                if (pd.progress)
                        p->progress = &pd;
                offset += work;
-               if (pthread_create(&p->pthread, NULL, preload_thread, p))
-                       die("unable to create threaded lstat");
+               err = pthread_create(&p->pthread, NULL, preload_thread, p);
+
+               if (err)
+                       die(_("unable to create threaded lstat: %s"), strerror(err));
        }
        for (i = 0; i < threads; i++) {
                struct thread_data *p = data+i;