squash! tests: do not require Git to be built when testing an installed Git

tests: do not require Git to be built when testing an installed Git

We really only need the test helpers to be built in the worktree in that
case, but that is not what we test for.

On the other hand it is a perfect opportunity to verify that
`GIT_TEST_INSTALLED` points to a working Git.

So let's test the appropriate Git executable. While at it, also adjust
the error message in the `GIT_TEST_INSTALLED` case.

This patch is best viewed with `-w --patience`.

Helped-by: Jeff King <peff@peff.net>
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
This commit is contained in:
Johannes Schindelin
2017-08-05 00:18:33 +02:00
parent fe37aea812
commit ce7b0f2e14

View File

@@ -51,10 +51,15 @@ export LSAN_OPTIONS
################################################################
# It appears that people try to run tests without building...
"$GIT_BUILD_DIR/git" >/dev/null
"${GIT_TEST_INSTALLED:-$GIT_BUILD_DIR}/git" >/dev/null
if test $? != 1
then
echo >&2 'error: you do not seem to have built git yet.'
if test -n "$GIT_TEST_INSTALLED"
then
echo >&2 "error: there is no working Git at '$GIT_TEST_INSTALLED'"
else
echo >&2 'error: you do not seem to have built git yet.'
fi
exit 1
fi