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