]> git.ipfire.org Git - thirdparty/git.git/commit
test-lib: respect GIT_TEST_INSTALLED when querying default hash
authorKyle Lippincott <spectral@google.com>
Tue, 15 Jul 2025 18:57:54 +0000 (18:57 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 15 Jul 2025 21:31:09 +0000 (14:31 -0700)
commitd79f8c6865862c9a48c095493735923800bcf34b
treefee45b5332d249aad4219a806a67b431c678770c
parenta6b007093a704324161fbf37c0c5bded1203d84a
test-lib: respect GIT_TEST_INSTALLED when querying default hash

$GIT_TEST_INSTALLED can be set to use an "installed" git instead of the
one from $GIT_BUILD_DIR. This is used by my company's internal test
infrastructure, and not using $GIT_TEST_INSTALLED when querying the
default hash meant that the tests were failing because the hash was
effectively set to the empty string (since git didn't execute).

In the two places we attempt to detect/execute git itself prior to
overriding everything and putting it in $PATH, use identical logic for
identifying the git binary to execute. This also has the effect of
including the $X suffix when querying the default hash, but that's not
strictly necessary. You don't need to specify .exe when running a binary
on Windows, just when testing whether it exists or not.

Signed-off-by: Kyle Lippincott <spectral@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/test-lib.sh