3 if [ "${CGIT_TEST_NO_GIT_VERSION}" = "YesPlease" ]; then
7 test_description
='Check Git version is correct'
8 CGIT_TEST_NO_CREATE_REPOS
=YesPlease
11 test_expect_success
'extract Git version from Makefile' '
12 sed -n -e "/^GIT_VER[ ]*=/ {
15 }" ../../Makefile >makefile_version
18 # Note that Git's GIT-VERSION-GEN script applies "s/-/./g" to the version
19 # string to produce the internal version in the GIT-VERSION-FILE, so we
20 # must apply the same transformation to the version in the Makefile before
22 test_expect_success
'test Git version matches Makefile' '
23 ( cat ../../git/GIT-VERSION-FILE || echo "No GIT-VERSION-FILE" ) |
24 sed -e "s/GIT_VERSION[ ]*=[ ]*//" -e "s/\\.dirty$//" >git_version &&
25 sed -e "s/-/./g" makefile_version >makefile_git_version &&
26 test_cmp git_version makefile_git_version
29 test_expect_success
'test submodule version matches Makefile' '
30 if ! test -e ../../git/.git
32 echo "git/ is not a Git repository" >&2
36 sm_oid=$(git ls-files --stage -- git |
37 sed -e "s/^[0-9]* \\([0-9a-f]*\\) [0-9] .*$/\\1/") &&
39 git describe --match "v[0-9]*" $sm_oid
40 ) | sed -e "s/^v//" -e "s/-/./" >sm_version &&
41 test_cmp sm_version makefile_version