git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
* [PATCH v1] preload-index: update GIT_FORCE_PRELOAD_TEST support
@ 2018-09-13 18:01 Ben Peart
  2018-09-13 21:39 ` Junio C Hamano
  0 siblings, 1 reply; 2+ messages in thread
From: Ben Peart @ 2018-09-13 18:01 UTC (permalink / raw)
  To: git; +Cc: gitster, Ben Peart, Ben Peart

Rename GIT_FORCE_PRELOAD_TEST to GIT_TEST_PRELOAD for consistency with the
other GIT_TEST_ special setups and properly document its use.

Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
---

Notes:
    Base Ref: v2.19.0
    Web-Diff: https://github.com/benpeart/git/commit/dcd201b920
    Checkout: git fetch https://github.com/benpeart/git git-test-preload-v1 && git checkout dcd201b920

 preload-index.c             | 2 +-
 t/README                    | 3 +++
 t/t7519-status-fsmonitor.sh | 4 ++--
 3 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/preload-index.c b/preload-index.c
index 71cd2437a3..cc8a7333c2 100644
--- a/preload-index.c
+++ b/preload-index.c
@@ -84,7 +84,7 @@ static void preload_index(struct index_state *index,
 		return;
 
 	threads = index->cache_nr / THREAD_COST;
-	if ((index->cache_nr > 1) && (threads < 2) && getenv("GIT_FORCE_PRELOAD_TEST"))
+	if ((index->cache_nr > 1) && (threads < 2) && git_env_bool("GIT_TEST_PRELOAD", 0))
 		threads = 2;
 	if (threads < 2)
 		return;
diff --git a/t/README b/t/README
index 9028b47d92..73fb09560f 100644
--- a/t/README
+++ b/t/README
@@ -319,6 +319,9 @@ GIT_TEST_OE_DELTA_SIZE=<n> exercises the uncomon pack-objects code
 path where deltas larger than this limit require extra memory
 allocation for bookkeeping.
 
+GIT_TEST_PRELOAD=<boolean> exercises the preload-index code path by
+overriding the minimum number of cache entries required per thread.
+
 Naming Tests
 ------------
 
diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh
index 756beb0d8e..9b703d49b5 100755
--- a/t/t7519-status-fsmonitor.sh
+++ b/t/t7519-status-fsmonitor.sh
@@ -245,9 +245,9 @@ do
 		git config core.preloadIndex $preload_val &&
 		if test $preload_val = true
 		then
-			GIT_FORCE_PRELOAD_TEST=$preload_val; export GIT_FORCE_PRELOAD_TEST
+			GIT_TEST_PRELOAD=$preload_val; export GIT_TEST_PRELOAD
 		else
-			unset GIT_FORCE_PRELOAD_TEST
+			sane_unset GIT_TEST_PRELOAD
 		fi
 	'
 

base-commit: 1d4361b0f344188ab5eec6dcea01f61a3a3a1670
-- 
2.18.0.windows.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH v1] preload-index: update GIT_FORCE_PRELOAD_TEST support
  2018-09-13 18:01 [PATCH v1] preload-index: update GIT_FORCE_PRELOAD_TEST support Ben Peart
@ 2018-09-13 21:39 ` Junio C Hamano
  0 siblings, 0 replies; 2+ messages in thread
From: Junio C Hamano @ 2018-09-13 21:39 UTC (permalink / raw)
  To: Ben Peart; +Cc: git\, Ben Peart

Ben Peart <benpeart@microsoft.com> writes:

> Rename GIT_FORCE_PRELOAD_TEST to GIT_TEST_PRELOAD for consistency with the
> other GIT_TEST_ special setups and properly document its use.
>
> Signed-off-by: Ben Peart <Ben.Peart@microsoft.com>
> ---
>

Among the two unrelated changes that are not mentioned in the
proposed log message, the change to the test to use sane_unset is
probably OK, but replacing a call to getenv() with git_env_bool()
without making sure necessary header file(s) are included would
break the build.

I _think_ config.h is the header to include; I didn't try it,
though.

Thanks.


> Notes:
>     Base Ref: v2.19.0
>     Web-Diff: https://github.com/benpeart/git/commit/dcd201b920
>     Checkout: git fetch https://github.com/benpeart/git git-test-preload-v1 && git checkout dcd201b920
>
>  preload-index.c             | 2 +-
>  t/README                    | 3 +++
>  t/t7519-status-fsmonitor.sh | 4 ++--
>  3 files changed, 6 insertions(+), 3 deletions(-)
>
> diff --git a/preload-index.c b/preload-index.c
> index 71cd2437a3..cc8a7333c2 100644
> --- a/preload-index.c
> +++ b/preload-index.c
> @@ -84,7 +84,7 @@ static void preload_index(struct index_state *index,
>  		return;
>  
>  	threads = index->cache_nr / THREAD_COST;
> -	if ((index->cache_nr > 1) && (threads < 2) && getenv("GIT_FORCE_PRELOAD_TEST"))
> +	if ((index->cache_nr > 1) && (threads < 2) && git_env_bool("GIT_TEST_PRELOAD", 0))
>  		threads = 2;
>  	if (threads < 2)
>  		return;
> diff --git a/t/README b/t/README
> index 9028b47d92..73fb09560f 100644
> --- a/t/README
> +++ b/t/README
> @@ -319,6 +319,9 @@ GIT_TEST_OE_DELTA_SIZE=<n> exercises the uncomon pack-objects code
>  path where deltas larger than this limit require extra memory
>  allocation for bookkeeping.
>  
> +GIT_TEST_PRELOAD=<boolean> exercises the preload-index code path by
> +overriding the minimum number of cache entries required per thread.
> +
>  Naming Tests
>  ------------
>  
> diff --git a/t/t7519-status-fsmonitor.sh b/t/t7519-status-fsmonitor.sh
> index 756beb0d8e..9b703d49b5 100755
> --- a/t/t7519-status-fsmonitor.sh
> +++ b/t/t7519-status-fsmonitor.sh
> @@ -245,9 +245,9 @@ do
>  		git config core.preloadIndex $preload_val &&
>  		if test $preload_val = true
>  		then
> -			GIT_FORCE_PRELOAD_TEST=$preload_val; export GIT_FORCE_PRELOAD_TEST
> +			GIT_TEST_PRELOAD=$preload_val; export GIT_TEST_PRELOAD
>  		else
> -			unset GIT_FORCE_PRELOAD_TEST
> +			sane_unset GIT_TEST_PRELOAD
>  		fi
>  	'
>  
>
> base-commit: 1d4361b0f344188ab5eec6dcea01f61a3a3a1670

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-13 18:01 [PATCH v1] preload-index: update GIT_FORCE_PRELOAD_TEST support Ben Peart
2018-09-13 21:39 ` Junio C Hamano

git@vger.kernel.org mailing list mirror (one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox