Skip to content

Commit 2e96d81

Browse files
avargitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 967a3ea commit 2e96d81

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

builtin/pack-objects.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2472,8 +2472,10 @@ static int git_pack_config(const char *k, const char *v, void *cb)
24722472
die("invalid number of threads specified (%d)",
24732473
delta_search_threads);
24742474
#ifdef NO_PTHREADS
2475-
if (delta_search_threads != 1)
2475+
if (delta_search_threads != 1) {
24762476
warning("no threads support, ignoring %s", k);
2477+
delta_search_threads = 0;
2478+
}
24772479
#endif
24782480
return 0;
24792481
}

t/t5300-pack-object.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ test_expect_success !PTHREADS,C_LOCALE_OUTPUT 'pack-objects --threads=N or pack.
447447
448448
git -c pack.threads=2 pack-objects --stdout --all </dev/null >/dev/null 2>err &&
449449
grep ^warning: err >warnings &&
450-
test_must_fail test_line_count = 1 warnings &&
450+
test_line_count = 1 warnings &&
451451
grep -F "no threads support, ignoring pack.threads" err &&
452452
453453
git -c pack.threads=2 pack-objects --threads=4 --stdout --all </dev/null >/dev/null 2>err &&

0 commit comments

Comments
 (0)