pack-objects: fix buggy warning about threads

Fix a buggy warning about threads under NO_PTHREADS=YesPlease. Due to re-using the delta_search_threads variable for both the state of the "pack.threads" config & the --threads option, setting "pack.threads" but not supplying --threads would trigger the warning for both "pack.threads" & --threads. Solve this bug by resetting the delta_search_threads variable in git_pack_config(), it might then be set by --threads again and be subsequently warned about, as the test I'm changing here asserts. Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Ævar Arnfjörð Bjarmason committed May 25, 2017 at 19:45 UTC 2e96d8154fc072b4778650560acca31a79ef86b0
2 files changed +4 -2
builtin/pack-objects.c
+3 -1
@@ -2472,8 +2472,10 @@ static int git_pack_config(const char *k, const char *v, void *cb)
2472 die("invalid number of threads specified (%d)",
2473 delta_search_threads);
2474 #ifdef NO_PTHREADS
2475 - if (delta_search_threads != 1)
2475 + if (delta_search_threads != 1) {
2476 warning("no threads support, ignoring %s", k);
2477 + delta_search_threads = 0;
2478 + }
2479 #endif
2480 return 0;
2481 }
t/t5300-pack-object.sh
+1 -1
@@ -447,7 +447,7 @@ test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'pack-objects --threads=N or pack.
447
448 git -c pack.threads=2 pack-objects --stdout --all </dev/null >/dev/null 2>err &&
449 grep ^warning: err >warnings &&
450 - test_must_fail test_line_count = 1 warnings &&
450 + test_line_count = 1 warnings &&
451 grep -F "no threads support, ignoring pack.threads" err &&
452
453 git -c pack.threads=2 pack-objects --threads=4 --stdout --all </dev/null >/dev/null 2>err &&