Web lists-archives.com

Re: [PATCH 09/10] read-cache.c: remove #ifdef NO_PTHREADS






On 10/29/2018 1:21 PM, Duy Nguyen wrote:
On Mon, Oct 29, 2018 at 6:05 PM Ben Peart <peartben@xxxxxxxxx> wrote:
@@ -2756,8 +2745,11 @@ static int do_write_index(struct index_state *istate, struct tempfile *tempfile,
       if (ce_write(&c, newfd, &hdr, sizeof(hdr)) < 0)
               return -1;

-#ifndef NO_PTHREADS
-     nr_threads = git_config_get_index_threads();
+     if (HAVE_THREADS)

This shouldn't be needed either.  My assumption was that if someone
explicitly asked for multiple threads we're better off failing than
silently ignoring their request.  The default/automatic setting will
detect the number of cpus and behave correctly.

No. I can have ~/.gitconfig shared between different machines. One
with multithread support and one without. I should not have to fall
back to conditional includes in order to use the same config file on
the machine without multithread.


If you want to share the ~/.gitconfig across machines that have different numbers of CPUs, it makes more sense to me to leave the setting at the "auto" setting rather than specifically overriding it to a number that won't work on at least one of your machines. Then it all "just works" without the need to conditional includes.