diff options
author | Ævar Arnfjörð Bjarmason <avarab@gmail.com> | 2017-04-16 22:21:01 +0000 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-04-16 21:34:04 -0700 |
commit | 1b6f38a8d6555d8a60b372a8a00e609e26cd3a44 (patch) | |
tree | 51b5b086d22f840f686eda8cfeaead3bb36e77a4 | |
parent | f65c67d2aa360c8d9a1e77a1379c97c89f8fa776 (diff) | |
download | git-1b6f38a8d6555d8a60b372a8a00e609e26cd3a44.tar.gz |
pack-objects: fix buggy warning about threads under NO_PTHREADS=YesPlease
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>
-rw-r--r-- | builtin/pack-objects.c | 4 | ||||
-rwxr-xr-x | t/t5300-pack-object.sh | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c index c7af475485..d21af8351a 100644 --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@ -2477,8 +2477,10 @@ static int git_pack_config(const char *k, const char *v, void *cb) die("invalid number of threads specified (%d)", delta_search_threads); #ifdef NO_PTHREADS - if (delta_search_threads != 1) + if (delta_search_threads != 1) { warning("no threads support, ignoring %s", k); + delta_search_threads = 0; + } #endif return 0; } diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh index 6bb6a8981b..50e1ae87a4 100755 --- a/t/t5300-pack-object.sh +++ b/t/t5300-pack-object.sh @@ -445,8 +445,7 @@ test_expect_success !PTHREADS,!GETTEXT_POISON 'pack-objects --threads=N or pack. git -c pack.threads=2 pack-objects --stdout --all </dev/null >/dev/null 2>err && cat err && grep ^warning: err >warnings && - test_line_count = 2 warnings && - grep "no threads support, ignoring --threads" err && + test_line_count = 1 warnings && grep "no threads support, ignoring pack\.threads" err && git -c pack.threads=2 pack-objects --threads=4 --stdout --all </dev/null >/dev/null 2>err && grep ^warning: err >warnings && |