{"thread":{"id":"49340","subject":"[PATCH v1] preload-index: update GIT_FORCE_PRELOAD_TEST support","startedAt":"2018-09-13T18:01:17Z","lastAt":"2018-09-13T21:40:02Z","messageCount":2,"participants":["Ben Peart","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"358066","messageId":"20180913180054.29720-1-benpeart@microsoft.com","threadId":"49340","inReplyTo":null,"subject":"[PATCH v1] preload-index: update GIT_FORCE_PRELOAD_TEST support","fromName":"Ben Peart","fromEmail":"benpeart@microsoft.com","sentAt":"2018-09-13T18:01:12Z","receivedAt":"2018-09-13T18:01:17Z","isPatch":true,"sender":{"key":"benpeart@microsoft.com","avatar":"https://avatars.githubusercontent.com/u/15252029?v=4"},"body":"Rename GIT_FORCE_PRELOAD_TEST to GIT_TEST_PRELOAD for consistency with the\nother GIT_TEST_ special setups and properly document its use.\n\nSigned-off-by: Ben Peart <Ben.Peart@microsoft.com>\n---\n\nNotes:\n    Base Ref: v2.19.0\n    Web-Diff: https://github.com/benpeart/git/commit/dcd201b920\n    Checkout: git fetch https://github.com/benpeart/git git-test-preload-v1 && git checkout dcd201b920\n\n preload-index.c             | 2 +-\n t/README                    | 3 +++\n t/t7519-status-fsmonitor.sh | 4 ++--\n 3 files changed, 6 insertions(+), 3 deletions(-)\n\ndiff --git a/preload-index.c b/preload-index.c\nindex 71cd2437a3..cc8a7333c2 100644\n--- a/preload-index.c\n+++ b/preload-index.c\n@@ -84,7 +84,7 @@ static void preload_index(struct index_state *index,\n \t\treturn;\n \n \tthreads = index->cache_nr / THREAD_COST;\n-\tif ((index->cache_nr > 1) && (threads < 2) && getenv(\"GIT_FORCE_PRELOAD_TEST\"))\n+\tif ((index->cache_nr > 1) && (threads < 2) && git_env_bool(\"GIT_TEST_PRELOAD\", 0))\n \t\tthreads = 2;\n \tif (threads < 2)\n \t\treturn;\ndiff --git a/t/README b/t/README\nindex 9028b47d92..73fb09560f 100644\n--- a/t/README\n+++ b/t/README\n@@ -319,6 +319,9 @@ GIT_TEST_OE_DELTA_SIZE=<n> exercises the uncomon pack-objects code\n path where deltas larger than this limit require extra memory\n allocation for bookkeeping.\n \n+GIT_TEST_PRELOAD=<boolean> exercises the preload-index code path by\n+overriding the minimum number of cache entries required per thread.\n+\n Naming Tests\n ------------\n \ndiff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh\nindex 756beb0d8e..9b703d49b5 100755\n--- a/t/t7519-status-fsmonitor.sh\n+++ b/t/t7519-status-fsmonitor.sh\n@@ -245,9 +245,9 @@ do\n \t\tgit config core.preloadIndex $preload_val &&\n \t\tif test $preload_val = true\n \t\tthen\n-\t\t\tGIT_FORCE_PRELOAD_TEST=$preload_val; export GIT_FORCE_PRELOAD_TEST\n+\t\t\tGIT_TEST_PRELOAD=$preload_val; export GIT_TEST_PRELOAD\n \t\telse\n-\t\t\tunset GIT_FORCE_PRELOAD_TEST\n+\t\t\tsane_unset GIT_TEST_PRELOAD\n \t\tfi\n \t'\n \n\nbase-commit: 1d4361b0f344188ab5eec6dcea01f61a3a3a1670\n-- \n2.18.0.windows.1\n\n"},{"id":"358093","messageId":"xmqqtvmtdqkx.fsf@gitster-ct.c.googlers.com","threadId":"49340","inReplyTo":"20180913180054.29720-1-benpeart@microsoft.com","subject":"Re: [PATCH v1] preload-index: update GIT_FORCE_PRELOAD_TEST support","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-09-13T21:39:58Z","receivedAt":"2018-09-13T21:40:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ben Peart <benpeart@microsoft.com> writes:\n\n> Rename GIT_FORCE_PRELOAD_TEST to GIT_TEST_PRELOAD for consistency with the\n> other GIT_TEST_ special setups and properly document its use.\n>\n> Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>\n> ---\n>\n\nAmong the two unrelated changes that are not mentioned in the\nproposed log message, the change to the test to use sane_unset is\nprobably OK, but replacing a call to getenv() with git_env_bool()\nwithout making sure necessary header file(s) are included would\nbreak the build.\n\nI _think_ config.h is the header to include; I didn't try it,\nthough.\n\nThanks.\n\n\n> Notes:\n>     Base Ref: v2.19.0\n>     Web-Diff: https://github.com/benpeart/git/commit/dcd201b920\n>     Checkout: git fetch https://github.com/benpeart/git git-test-preload-v1 && git checkout dcd201b920\n>\n>  preload-index.c             | 2 +-\n>  t/README                    | 3 +++\n>  t/t7519-status-fsmonitor.sh | 4 ++--\n>  3 files changed, 6 insertions(+), 3 deletions(-)\n>\n> diff --git a/preload-index.c b/preload-index.c\n> index 71cd2437a3..cc8a7333c2 100644\n> --- a/preload-index.c\n> +++ b/preload-index.c\n> @@ -84,7 +84,7 @@ static void preload_index(struct index_state *index,\n>  \t\treturn;\n>  \n>  \tthreads = index->cache_nr / THREAD_COST;\n> -\tif ((index->cache_nr > 1) && (threads < 2) && getenv(\"GIT_FORCE_PRELOAD_TEST\"))\n> +\tif ((index->cache_nr > 1) && (threads < 2) && git_env_bool(\"GIT_TEST_PRELOAD\", 0))\n>  \t\tthreads = 2;\n>  \tif (threads < 2)\n>  \t\treturn;\n> diff --git a/t/README b/t/README\n> index 9028b47d92..73fb09560f 100644\n> --- a/t/README\n> +++ b/t/README\n> @@ -319,6 +319,9 @@ GIT_TEST_OE_DELTA_SIZE=<n> exercises the uncomon pack-objects code\n>  path where deltas larger than this limit require extra memory\n>  allocation for bookkeeping.\n>  \n> +GIT_TEST_PRELOAD=<boolean> exercises the preload-index code path by\n> +overriding the minimum number of cache entries required per thread.\n> +\n>  Naming Tests\n>  ------------\n>  \n> diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh\n> index 756beb0d8e..9b703d49b5 100755\n> --- a/t/t7519-status-fsmonitor.sh\n> +++ b/t/t7519-status-fsmonitor.sh\n> @@ -245,9 +245,9 @@ do\n>  \t\tgit config core.preloadIndex $preload_val &&\n>  \t\tif test $preload_val = true\n>  \t\tthen\n> -\t\t\tGIT_FORCE_PRELOAD_TEST=$preload_val; export GIT_FORCE_PRELOAD_TEST\n> +\t\t\tGIT_TEST_PRELOAD=$preload_val; export GIT_TEST_PRELOAD\n>  \t\telse\n> -\t\t\tunset GIT_FORCE_PRELOAD_TEST\n> +\t\t\tsane_unset GIT_TEST_PRELOAD\n>  \t\tfi\n>  \t'\n>  \n>\n> base-commit: 1d4361b0f344188ab5eec6dcea01f61a3a3a1670\n"}]}