]> gitweb.ps.run Git - ps-cgit/blobdiff - tests/t0001-validate-git-versions.sh
ui-repolist: do not return unsigned (negative) value
[ps-cgit] / tests / t0001-validate-git-versions.sh
index 754046ee306efccea2827a541b90160b45af9eac..3200f31101a0c2c94963a24291bd176a251ab4bd 100755 (executable)
@@ -11,10 +11,15 @@ test_expect_success 'extract Git version from Makefile' '
        }" ../../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[  ]*=[    ]*//" >git_version &&
-       test_cmp git_version makefile_version
+       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' '
@@ -28,7 +33,7 @@ test_expect_success 'test submodule version matches Makefile' '
                                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 &&
+               ) | sed -e "s/^v//" -e "s/-/./" >sm_version &&
                test_cmp sm_version makefile_version
        fi
 '