test-lib: try harder to ensure a working jgit
The JGIT prereq uses `type jgit` to determine whether jgit is present. While this is usually sufficient, it won't help if the jgit found is badly broken. This wastes time running tests which fail due to no fault of our own. Use `jgit --version` instead, to guard against cases where jgit is present on the system, but will fail to run, e.g. because of some JRE issue, or missing Java dependencies. Checking that it gets far enough to process the '--version' argument isn't perfect, but seems to be good enough in practice. It's also consistent with how we detect some other dependencies, see e.g. the CURL and UNZIP prerequisites. Signed-off-by: Todd Zullinger <tmz@pobox.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Todd Zullinger committed
May 14, 2019 at 21:36 UTC
abd0f289839f6029983a83707f43029c4a2ebf07
1 file changed
+1
-1
t/test-lib.sh
+1
-1
@@ -1476,7 +1476,7 @@ test_lazy_prereq NOT_ROOT '
1476
'
1477
1478
test_lazy_prereq JGIT '
1479
- type jgit
1479
+ jgit --version
1480
'
1481
1482
# SANITY is about "can you correctly predict what the filesystem would