Subject: Re: [PATCH] test-lib: respect GIT_TEST_INSTALLED when querying default hash

From: Junio C Hamano <[email-masked]>
Date: Tue, 15 Jul 2025 14:27:47 -0700

"Kyle Lippincott via GitGitGadget" <[email-masked]> writes:

>  ################################################################
>  # It appears that people try to run tests without building...
> -"${GIT_TEST_INSTALLED:-$GIT_BUILD_DIR}/git$X" >/dev/null
> +GIT_BINARY="${GIT_TEST_INSTALLED:-$GIT_BUILD_DIR}/git$X"
> +"$GIT_BINARY" >/dev/null
>  if test $? != 1
>  then
>  	if test -n "$GIT_TEST_INSTALLED"
> @@ -536,7 +537,7 @@ export GIT_COMMITTER_EMAIL GIT_COMMITTER_NAME
>  export GIT_COMMITTER_DATE GIT_AUTHOR_DATE
>  export EDITOR
>  
> -GIT_TEST_BUILTIN_HASH=$("$GIT_BUILD_DIR/git" version --build-options | sed -ne 's/^default-hash: //p')
> +GIT_TEST_BUILTIN_HASH=$("$GIT_BINARY" version --build-options | sed -ne 's/^default-hash: //p')

Very nice.  I very much like the way this reuses what we detected earlier.

Thanks, will queue.

>  GIT_DEFAULT_HASH="${GIT_TEST_DEFAULT_HASH:-$GIT_TEST_BUILTIN_HASH}"
>  export GIT_DEFAULT_HASH
>  GIT_DEFAULT_REF_FORMAT="${GIT_TEST_DEFAULT_REF_FORMAT:-files}"
>
> base-commit: e9779f64349fbcc8d177d055208039877316e652