mirror of
https://git.zx2c4.com/cgit
synced 2024-11-09 18:18:42 +00:00
8d07ad3388
When creating the GIT-VERSION-FILE that we use to test that the version of Git in git/ is the same as in the CGit Makefile, Git applies the transform "s/-/./g" to the version string. This doesn't affect released versions but does change RC version numbers such as 1.8.3-rc0. While CGit should only refer to a released Git version in general, it is useful to developers who want to test upcoming Git releases if the tests do work with RCs, so change t0001 to apply the same transform to our Makefile version before comparing it to the contents of GIT-VERSION-FILE. Signed-off-by: John Keeping <john@keeping.me.uk>
42 lines
1.2 KiB
Bash
Executable File
42 lines
1.2 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
test_description='Check Git version is correct'
|
|
CGIT_TEST_NO_CREATE_REPOS=YesPlease
|
|
. ./setup.sh
|
|
|
|
test_expect_success 'extract Git version from Makefile' '
|
|
sed -n -e "/^GIT_VER[ ]*=/ {
|
|
s/^GIT_VER[ ]*=[ ]*//
|
|
p
|
|
}" ../../Makefile >makefile_version
|
|
'
|
|
|
|
# Note that Git's GIT-VERSION-GEN script applies "s/-/./g" to the version
|
|
# string to produce the internal version in the GIT-VERSION-FILE, so we
|
|
# must apply the same transformation to the version in the Makefile before
|
|
# comparing them.
|
|
test_expect_success 'test Git version matches Makefile' '
|
|
( cat ../../git/GIT-VERSION-FILE || echo "No GIT-VERSION-FILE" ) |
|
|
sed -e "s/GIT_VERSION[ ]*=[ ]*//" -e "s/\\.dirty$//" >git_version &&
|
|
sed -e "s/-/./g" makefile_version >makefile_git_version &&
|
|
test_cmp git_version makefile_git_version
|
|
'
|
|
|
|
test_expect_success 'test submodule version matches Makefile' '
|
|
if ! test -e ../../git/.git
|
|
then
|
|
echo "git/ is not a Git repository" >&2
|
|
else
|
|
(
|
|
cd ../.. &&
|
|
sm_sha1=$(git ls-files --stage -- git |
|
|
sed -e "s/^[0-9]* \\([0-9a-f]*\\) [0-9] .*$/\\1/") &&
|
|
cd git &&
|
|
git describe --match "v[0-9]*" $sm_sha1
|
|
) | sed -e "s/^v//" >sm_version &&
|
|
test_cmp sm_version makefile_version
|
|
fi
|
|
'
|
|
|
|
test_done
|