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> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Johannes Schindelin committed Nov 14, 2018 at 08:32 UTC ed306e4e0fbb621001f008e6d50718898be4fc09
1 file changed +7 -2
t/test-lib.sh
+7 -2
@@ -51,10 +51,15 @@ export LSAN_OPTIONS
51
52 ################################################################
53 # It appears that people try to run tests without building...
54 -"$GIT_BUILD_DIR/git" >/dev/null
54 +"${GIT_TEST_INSTALLED:-$GIT_BUILD_DIR}/git" >/dev/null
55 if test $? != 1
56 then
57 - echo >&2 'error: you do not seem to have built git yet.'
57 + if test -n "$GIT_TEST_INSTALLED"
58 + then
59 + echo >&2 "error: there is no working Git at '$GIT_TEST_INSTALLED'"
60 + else
61 + echo >&2 'error: you do not seem to have built git yet.'
62 + fi
63 exit 1
64 fi
65