{"thread":{"id":"45715","subject":"[PATCH v2 0/8] grep threading cleanup & tests","startedAt":"2017-04-16T22:21:20Z","lastAt":"2017-04-16T22:21:55Z","messageCount":9,"participants":["Ævar Arnfjörð Bjarmason"],"isPatch":true,"patchVersion":2,"patchTotal":8},"messages":[{"id":"316960","messageId":"20170416222102.2320-1-avarab@gmail.com","threadId":"45715","inReplyTo":null,"subject":"[PATCH v2 0/8] grep threading cleanup & tests","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-04-16T22:20:54Z","receivedAt":"2017-04-16T22:21:20Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This is the spiritual successor to the \"grep: add ability to disable\nthreading with --threads=0 or grep.threads=0\" patch I submitted as\npart of my PCRE series (<20170408132506.5415-2-avarab@gmail.com>).\n\nThere's a long back & forth thread between me and Jeff King as a\nfollow-up to that which I'll summarize: I'd misunderstood what\n--threads=1 does, because I was tracing how often a pattern was\ncompiled, and observing that even with --threads=1 we'd compile the\npattern twice.\n\nThis series fixes that redundant needless compilation in 3/8, skips\npthread overhead as Jeff suggested kin 3/8. The rest of the patches\nare a bunch of small related fixes I noticed along the way.\n\nÆvar Arnfjörð Bjarmason (8):\n  grep: assert that threading is enabled when calling grep_{lock,unlock}\n  grep: add tests for --threads=N and grep.threads\n  grep: don't redundantly compile throwaway patterns under threading\n  grep: skip pthreads overhead when using one thread\n  tests: add a PTHREADS prerequisite\n  pack-object & index-pack: add test for --threads warning under\n    NO_PTHREADS\n  pack-objects: fix buggy warning about threads under\n    NO_PTHREADS=YesPlease\n  grep: given --threads with NO_PTHREADS=YesPlease, warn\n\n Makefile               |  1 +\n builtin/grep.c         | 32 +++++++++++++++++++++++++-------\n builtin/pack-objects.c |  4 +++-\n t/README               |  4 ++++\n t/t5300-pack-object.sh | 33 +++++++++++++++++++++++++++++++++\n t/t7810-grep.sh        | 34 ++++++++++++++++++++++++++++++++++\n t/test-lib.sh          |  1 +\n 7 files changed, 101 insertions(+), 8 deletions(-)\n\n-- \n2.11.0\n\n"},{"id":"316961","messageId":"20170416222102.2320-2-avarab@gmail.com","threadId":"45715","inReplyTo":"20170416222102.2320-1-avarab@gmail.com","subject":"[PATCH v2 1/8] grep: assert that threading is enabled when calling grep_{lock,unlock}","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-04-16T22:20:55Z","receivedAt":"2017-04-16T22:21:26Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the grep_{lock,unlock} functions to assert that num_threads is\ntrue, instead of only locking & unlocking the pthread mutex lock when\nit is.\n\nThese functions are never called when num_threads isn't true, this\nlogic has gone through multiple iterations since the initial\nintroduction of grep threading in commit 5b594f457a (\"Threaded grep\",\n2010-01-25), but ever since then they'd only be called if num_threads\nwas true, so this check made the code confusing to read.\n\nReplace the check with an assertion, so that it's clear to the reader\nthat this code path is never taken unless we're spawning threads.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/grep.c | 8 ++++----\n 1 file changed, 4 insertions(+), 4 deletions(-)\n\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 65070c52fc..3aa7836a04 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -73,14 +73,14 @@ static pthread_mutex_t grep_mutex;\n \n static inline void grep_lock(void)\n {\n-\tif (num_threads)\n-\t\tpthread_mutex_lock(&grep_mutex);\n+\tassert(num_threads);\n+\tpthread_mutex_lock(&grep_mutex);\n }\n \n static inline void grep_unlock(void)\n {\n-\tif (num_threads)\n-\t\tpthread_mutex_unlock(&grep_mutex);\n+\tassert(num_threads);\n+\tpthread_mutex_unlock(&grep_mutex);\n }\n \n /* Signalled when a new work_item is added to todo. */\n-- \n2.11.0\n\n"},{"id":"316962","messageId":"20170416222102.2320-3-avarab@gmail.com","threadId":"45715","inReplyTo":"20170416222102.2320-1-avarab@gmail.com","subject":"[PATCH v2 2/8] grep: add tests for --threads=N and grep.threads","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-04-16T22:20:56Z","receivedAt":"2017-04-16T22:21:34Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add tests for when --threads=N is supplied on the command-line or when\ngrep.threads is supplied in the configuration.\n\nWhen the threading support was made run-time configurable in commit\n89f09dd34e (\"grep: add --threads=<num> option and grep.threads\nconfiguration\", 2015-12-15) no tests were added for it.\n\nIn developing a change to grep I was able to make '--threads=1 <pat>`\nsegfault, while the test suite still passed. This change fixes that\nblind spot in the tests.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t7810-grep.sh | 16 ++++++++++++++++\n 1 file changed, 16 insertions(+)\n\ndiff --git a/t/t7810-grep.sh b/t/t7810-grep.sh\nindex cee42097b0..4523ca926b 100755\n--- a/t/t7810-grep.sh\n+++ b/t/t7810-grep.sh\n@@ -771,6 +771,22 @@ test_expect_success 'grep -W with userdiff' '\n \ttest_cmp expected actual\n '\n \n+for threads in $(test_seq 0 10)\n+do\n+\ttest_expect_success \"grep --threads=$threads & -c grep.threads=$threads\" \"\n+\t\tgit grep --threads=$threads . >actual.$threads &&\n+\t\tif test $threads -ge 1\n+\t\tthen\n+\t\t\ttest_cmp actual.\\$(($threads - 1)) actual.$threads\n+\t\tfi &&\n+\t\tgit -c grep.threads=$threads grep . >actual.$threads &&\n+\t\tif test $threads -ge 1\n+\t\tthen\n+\t\t\ttest_cmp actual.\\$(($threads - 1)) actual.$threads\n+\t\tfi\n+\t\"\n+done\n+\n test_expect_success 'grep from a subdirectory to search wider area (1)' '\n \tmkdir -p s &&\n \t(\n-- \n2.11.0\n\n"},{"id":"316963","messageId":"20170416222102.2320-4-avarab@gmail.com","threadId":"45715","inReplyTo":"20170416222102.2320-1-avarab@gmail.com","subject":"[PATCH v2 3/8] grep: don't redundantly compile throwaway patterns under threading","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-04-16T22:20:57Z","receivedAt":"2017-04-16T22:21:36Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the pattern compilation logic under threading so that grep\ndoesn't compile a pattern it never ends up using on the non-threaded\ncode path, only to compile it again N times for N threads which will\neach use their own copy, ignoring the initially compiled pattern.\n\nThis redundant compilation dates back to the initial introduction of\nthe threaded grep in commit 5b594f457a (\"Threaded grep\",\n2010-01-25).\n\nThere was never any reason for doing this redundant work other than an\noversight in the initial commit. Jeff King suggested on-list in\n<20170414212325.fefrl3qdjigwyitd@sigill.intra.peff.net> that this\nmight be needed to check the pattern for sanity before threaded\nexecution commences.\n\nThat's not the case. The pattern is compiled under threading in\nstart_threads() before any concurrent execution has started by calling\npthread_create(), so if the pattern contains an error we still do the\nright thing. I.e. die with one error before any threaded execution has\ncommenced, instead of e.g. spewing out an error for each N threads,\nwhich could be a regression a change like this might inadvertently\nintroduce.\n\nThe undocumented --debug mode added in commit 17bf35a3c7 (\"grep: teach\n--debug option to dump the parse tree\", 2012-09-13) still works\nproperly with this change. It only emits debugging info during pattern\ncompilation, which is now dumped by the pattern compiled just before\nthe first thread is started.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/grep.c | 14 +++++++++++---\n 1 file changed, 11 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex 3aa7836a04..a3d380551b 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -224,7 +224,8 @@ static void start_threads(struct grep_opt *opt)\n \t\tint err;\n \t\tstruct grep_opt *o = grep_opt_dup(opt);\n \t\to->output = strbuf_out;\n-\t\to->debug = 0;\n+\t\tif (i)\n+\t\t\to->debug = 0;\n \t\tcompile_grep_patterns(o);\n \t\terr = pthread_create(&threads[i], NULL, run, o);\n \n@@ -1154,8 +1155,6 @@ int cmd_grep(int argc, const char **argv, const char *prefix)\n \tif (!opt.fixed && opt.ignore_case)\n \t\topt.regflags |= REG_ICASE;\n \n-\tcompile_grep_patterns(&opt);\n-\n \t/*\n \t * We have to find \"--\" in a separate pass, because its presence\n \t * influences how we will parse arguments that come before it.\n@@ -1230,6 +1229,15 @@ int cmd_grep(int argc, const char **argv, const char *prefix)\n \tnum_threads = 0;\n #endif\n \n+\tif (!num_threads)\n+\t\t/*\n+\t\t * The compiled patterns on the main path are only\n+\t\t * used when not using threading. Otherwise\n+\t\t * start_threads() below calls compile_grep_patterns()\n+\t\t * for each thread.\n+\t\t */\n+\t\tcompile_grep_patterns(&opt);\n+\n #ifndef NO_PTHREADS\n \tif (num_threads) {\n \t\tif (!(opt.name_only || opt.unmatch_name_only || opt.count)\n-- \n2.11.0\n\n"},{"id":"316964","messageId":"20170416222102.2320-5-avarab@gmail.com","threadId":"45715","inReplyTo":"20170416222102.2320-1-avarab@gmail.com","subject":"[PATCH v2 4/8] grep: skip pthreads overhead when using one thread","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-04-16T22:20:58Z","receivedAt":"2017-04-16T22:21:43Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Skip the administrative overhead of using pthreads when only using one\nthread. Instead take the non-threaded path which would be taken under\nNO_PTHREADS.\n\nThe threading support was initially added in commit\n5b594f457a (\"Threaded grep\", 2010-01-25) with a hardcoded compile-time\nnumber of 8 threads. Later the number of threads was made configurable\nin commit 89f09dd34e (\"grep: add --threads=<num> option and\ngrep.threads configuration\", 2015-12-15).\n\nThat change did not add any special handling for --threads=1. Now we\ntake a slightly faster path by skipping thread handling entirely when\n1 thread is requested.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/grep.c | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex a3d380551b..cb3323060e 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -1225,6 +1225,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)\n \t\tnum_threads = GREP_NUM_THREADS_DEFAULT;\n \telse if (num_threads < 0)\n \t\tdie(_(\"invalid number of threads specified (%d)\"), num_threads);\n+\tif (num_threads == 1)\n+\t\tnum_threads = 0;\n #else\n \tnum_threads = 0;\n #endif\n-- \n2.11.0\n\n"},{"id":"316965","messageId":"20170416222102.2320-6-avarab@gmail.com","threadId":"45715","inReplyTo":"20170416222102.2320-1-avarab@gmail.com","subject":"[PATCH v2 5/8] tests: add a PTHREADS prerequisite","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-04-16T22:20:59Z","receivedAt":"2017-04-16T22:21:45Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add a PTHREADS prerequisite which is false when git is compiled with\nNO_PTHREADS=YesPlease.\n\nThere's lots of custom code that runs when threading isn't available,\nbut before this prerequisite there was no way to test it.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile      | 1 +\n t/README      | 4 ++++\n t/test-lib.sh | 1 +\n 3 files changed, 6 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex 9b36068ac5..9753281acd 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2235,6 +2235,7 @@ GIT-BUILD-OPTIONS: FORCE\n \t@echo NO_EXPAT=\\''$(subst ','\\'',$(subst ','\\'',$(NO_EXPAT)))'\\' >>$@+\n \t@echo USE_LIBPCRE=\\''$(subst ','\\'',$(subst ','\\'',$(USE_LIBPCRE)))'\\' >>$@+\n \t@echo NO_PERL=\\''$(subst ','\\'',$(subst ','\\'',$(NO_PERL)))'\\' >>$@+\n+\t@echo NO_PTHREADS=\\''$(subst ','\\'',$(subst ','\\'',$(NO_PTHREADS)))'\\' >>$@+\n \t@echo NO_PYTHON=\\''$(subst ','\\'',$(subst ','\\'',$(NO_PYTHON)))'\\' >>$@+\n \t@echo NO_UNIX_SOCKETS=\\''$(subst ','\\'',$(subst ','\\'',$(NO_UNIX_SOCKETS)))'\\' >>$@+\n \t@echo PAGER_ENV=\\''$(subst ','\\'',$(subst ','\\'',$(PAGER_ENV)))'\\' >>$@+\ndiff --git a/t/README b/t/README\nindex ab386c3681..6775ced582 100644\n--- a/t/README\n+++ b/t/README\n@@ -817,6 +817,10 @@ use these, and \"test_set_prereq\" for how to define your own.\n    Test is run on a filesystem which converts decomposed utf-8 (nfd)\n    to precomposed utf-8 (nfc).\n \n+ - PTHREADS\n+\n+   Git wasn't compiled with NO_PTHREADS=YesPlease.\n+\n Tips for Writing Tests\n ----------------------\n \ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 13b5696822..fba91bad3a 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -1009,6 +1009,7 @@ esac\n \n ( COLUMNS=1 && test $COLUMNS = 1 ) && test_set_prereq COLUMNS_CAN_BE_1\n test -z \"$NO_PERL\" && test_set_prereq PERL\n+test -z \"$NO_PTHREADS\" && test_set_prereq PTHREADS\n test -z \"$NO_PYTHON\" && test_set_prereq PYTHON\n test -n \"$USE_LIBPCRE\" && test_set_prereq LIBPCRE\n test -z \"$NO_GETTEXT\" && test_set_prereq GETTEXT\n-- \n2.11.0\n\n"},{"id":"316966","messageId":"20170416222102.2320-9-avarab@gmail.com","threadId":"45715","inReplyTo":"20170416222102.2320-1-avarab@gmail.com","subject":"[PATCH v2 8/8] grep: given --threads with NO_PTHREADS=YesPlease, warn","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-04-16T22:21:02Z","receivedAt":"2017-04-16T22:21:52Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add a warning about missing thread support when grep.threads or\n--threads is set to a non 0 (default) or 1 (no parallelism) value\nunder NO_PTHREADS=YesPlease.\n\nThis is for consistency with the index-pack & pack-objects commands,\nwhich also take a --threads option & are configurable via\npack.threads, and have long warned about the same under\nNO_PTHREADS=YesPlease.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/grep.c  |  8 ++++++++\n t/t7810-grep.sh | 18 ++++++++++++++++++\n 2 files changed, 26 insertions(+)\n\ndiff --git a/builtin/grep.c b/builtin/grep.c\nindex cb3323060e..c746cdd33c 100644\n--- a/builtin/grep.c\n+++ b/builtin/grep.c\n@@ -290,6 +290,12 @@ static int grep_cmd_config(const char *var, const char *value, void *cb)\n \t\tif (num_threads < 0)\n \t\t\tdie(_(\"invalid number of threads specified (%d) for %s\"),\n \t\t\t    num_threads, var);\n+#ifdef NO_PTHREADS\n+\t\telse if (num_threads && num_threads != 1) {\n+\t\t\twarning(_(\"no threads support, ignoring %s\"), var);\n+\t\t\tnum_threads = 0;\n+\t\t}\n+#endif\n \t}\n \n \treturn st;\n@@ -1228,6 +1234,8 @@ int cmd_grep(int argc, const char **argv, const char *prefix)\n \tif (num_threads == 1)\n \t\tnum_threads = 0;\n #else\n+\tif (num_threads)\n+\t\twarning(_(\"no threads support, ignoring --threads\"));\n \tnum_threads = 0;\n #endif\n \ndiff --git a/t/t7810-grep.sh b/t/t7810-grep.sh\nindex 4523ca926b..f4c225b410 100755\n--- a/t/t7810-grep.sh\n+++ b/t/t7810-grep.sh\n@@ -787,6 +787,24 @@ do\n \t\"\n done\n \n+test_expect_success !PTHREADS,!GETTEXT_POISON 'grep --threads=N or pack.threads=N warns when no pthreads' '\n+\tgit grep --threads=2 Hello hello_world 2>err &&\n+\tgrep ^warning: err >warnings &&\n+\ttest_line_count = 1 warnings &&\n+\tgrep \"no threads support, ignoring --threads\" err &&\n+\tgit -c grep.threads=2 grep Hello hello_world 2>err &&\n+\tgrep ^warning: err >warnings &&\n+\ttest_line_count = 1 warnings &&\n+\tgrep \"no threads support, ignoring grep\\.threads\" err &&\n+\tgit -c grep.threads=2 grep --threads=4 Hello hello_world 2>err &&\n+\tgrep ^warning: err >warnings &&\n+\ttest_line_count = 2 warnings &&\n+\tgrep \"no threads support, ignoring --threads\" err &&\n+\tgrep \"no threads support, ignoring grep\\.threads\" err &&\n+\tgit -c grep.threads=0 grep --threads=0 Hello hello_world 2>err &&\n+\ttest_line_count = 0 err\n+'\n+\n test_expect_success 'grep from a subdirectory to search wider area (1)' '\n \tmkdir -p s &&\n \t(\n-- \n2.11.0\n\n"},{"id":"316967","messageId":"20170416222102.2320-8-avarab@gmail.com","threadId":"45715","inReplyTo":"20170416222102.2320-1-avarab@gmail.com","subject":"[PATCH v2 7/8] pack-objects: fix buggy warning about threads under NO_PTHREADS=YesPlease","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-04-16T22:21:01Z","receivedAt":"2017-04-16T22:21:53Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Fix a buggy warning about threads under NO_PTHREADS=YesPlease. Due to\nre-using the delta_search_threads variable for both the state of the\n\"pack.threads\" config & the --threads option setting \"pack.threads\"\nbut not supplying --threads would trigger the warning for both\n\"pack.threads\" & --threads.\n\nSolve this bug by resetting the delta_search_threads variable in\ngit_pack_config(), it might then be set by --threads again and be\nsubsequently warned about, as the test I'm changing here asserts.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n builtin/pack-objects.c | 4 +++-\n t/t5300-pack-object.sh | 3 +--\n 2 files changed, 4 insertions(+), 3 deletions(-)\n\ndiff --git a/builtin/pack-objects.c b/builtin/pack-objects.c\nindex 84af7c2324..905465e91f 100644\n--- a/builtin/pack-objects.c\n+++ b/builtin/pack-objects.c\n@@ -2472,8 +2472,10 @@ static int git_pack_config(const char *k, const char *v, void *cb)\n \t\t\tdie(\"invalid number of threads specified (%d)\",\n \t\t\t    delta_search_threads);\n #ifdef NO_PTHREADS\n-\t\tif (delta_search_threads != 1)\n+\t\tif (delta_search_threads != 1) {\n \t\t\twarning(\"no threads support, ignoring %s\", k);\n+\t\t\tdelta_search_threads = 0;\n+\t\t}\n #endif\n \t\treturn 0;\n \t}\ndiff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh\nindex 6bb6a8981b..50e1ae87a4 100755\n--- a/t/t5300-pack-object.sh\n+++ b/t/t5300-pack-object.sh\n@@ -445,8 +445,7 @@ test_expect_success !PTHREADS,!GETTEXT_POISON 'pack-objects --threads=N or pack.\n \tgit -c pack.threads=2 pack-objects --stdout --all </dev/null >/dev/null 2>err &&\n \tcat err &&\n \tgrep ^warning: err >warnings &&\n-\ttest_line_count = 2 warnings &&\n-\tgrep \"no threads support, ignoring --threads\" err &&\n+\ttest_line_count = 1 warnings &&\n \tgrep \"no threads support, ignoring pack\\.threads\" err &&\n \tgit -c pack.threads=2 pack-objects --threads=4 --stdout --all </dev/null >/dev/null 2>err &&\n \tgrep ^warning: err >warnings &&\n-- \n2.11.0\n\n"},{"id":"316968","messageId":"20170416222102.2320-7-avarab@gmail.com","threadId":"45715","inReplyTo":"20170416222102.2320-1-avarab@gmail.com","subject":"[PATCH v2 6/8] pack-object & index-pack: add test for --threads warning under NO_PTHREADS","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2017-04-16T22:21:00Z","receivedAt":"2017-04-16T22:21:55Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Add a test for the warning that's emitted when --threads or\npack.threads is provided under NO_PTHREADS. This uses the new PTHREADS\nprerequisite.\n\nThe assertion for !GETTEXT_POISON in the latter test is currently\nredundant, since unlike index-pack the pack-objects warnings aren't\ni18n'd. However they might be changed to be i18n'd in the future, and\nthere's no harm in future-proofing the test.\n\nThere's an existing bug in the implementation of pack-objects which\nthis test currently tests for as-is. Details about the bug & the fix\nare included in a follow-up change.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t5300-pack-object.sh | 34 ++++++++++++++++++++++++++++++++++\n 1 file changed, 34 insertions(+)\n\ndiff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh\nindex 43a672c345..6bb6a8981b 100755\n--- a/t/t5300-pack-object.sh\n+++ b/t/t5300-pack-object.sh\n@@ -421,6 +421,40 @@ test_expect_success 'index-pack <pack> works in non-repo' '\n \ttest_path_is_file foo.idx\n '\n \n+test_expect_success !PTHREADS,!GETTEXT_POISON 'index-pack --threads=N or pack.threads=N warns when no pthreads' '\n+\ttest_must_fail git index-pack --threads=2 2>err &&\n+\tgrep ^warning: err >warnings &&\n+\ttest_line_count = 1 warnings &&\n+\tgrep \"no threads support, ignoring --threads=2\" err &&\n+\ttest_must_fail git -c pack.threads=2 index-pack 2>err &&\n+\tgrep ^warning: err >warnings &&\n+\ttest_line_count = 1 warnings &&\n+\tgrep \"no threads support, ignoring pack\\.threads\" err &&\n+\ttest_must_fail git -c pack.threads=2 index-pack --threads=4 2>err &&\n+\tgrep ^warning: err >warnings &&\n+\ttest_line_count = 2 warnings &&\n+\tgrep \"no threads support, ignoring --threads=4\" err &&\n+\tgrep \"no threads support, ignoring pack\\.threads\" err\n+'\n+\n+test_expect_success !PTHREADS,!GETTEXT_POISON 'pack-objects --threads=N or pack.threads=N warns when no pthreads' '\n+\tgit pack-objects --threads=2 --stdout --all </dev/null >/dev/null 2>err &&\n+\tgrep ^warning: err >warnings &&\n+\ttest_line_count = 1 warnings &&\n+\tgrep \"no threads support, ignoring --threads\" err &&\n+\tgit -c pack.threads=2 pack-objects --stdout --all </dev/null >/dev/null 2>err &&\n+\tcat err &&\n+\tgrep ^warning: err >warnings &&\n+\ttest_line_count = 2 warnings &&\n+\tgrep \"no threads support, ignoring --threads\" err &&\n+\tgrep \"no threads support, ignoring pack\\.threads\" err &&\n+\tgit -c pack.threads=2 pack-objects --threads=4 --stdout --all </dev/null >/dev/null 2>err &&\n+\tgrep ^warning: err >warnings &&\n+\ttest_line_count = 2 warnings &&\n+\tgrep \"no threads support, ignoring --threads\" err &&\n+\tgrep \"no threads support, ignoring pack\\.threads\" err\n+'\n+\n #\n # WARNING!\n #\n-- \n2.11.0\n\n"}]}