#!/bin/sh
-extract_svn_version()
+extract_git_version()
{
- if [ -d "$1"/.svn ]
+ if [ -d "$1"/.git ]
then
- svnversion -n "$1"
- elif [ -d "$1"/.git/svn ]
- then
- cd "$1" || exit 1
- git svn info . | grep '^Revision' | cut -d ' ' -f2 | tr -d '\n'
+ git rev-parse --short=10 HEAD
else
echo "unknown"
fi
else
cat > include/vgversion.h.tmp <<EOF
/* Do not edit: file generated by auxprogs/make_or_upd_vgversion_h.
- This file defines VGSVN and VEXSVN, used to report SVN revision
- when using command line options: -v --version
+ This file defines VGGIT, used to report GIT revision
+ when using command line options: -v --version
*/
-#define VGSVN "$(extract_svn_version "$srcdir/.")"
-#define VEXSVN "$(extract_svn_version "$srcdir/VEX")"
+#define VGGIT "$(extract_git_version .)"
EOF
fi
if [ -f include/vgversion.h ]
then
# There is already a vgversion.h.
- # Update it only if we found a different and real svn version
+ # Update it only if we found a different and real git version
if grep -q unknown include/vgversion.h.tmp ||
cmp -s include/vgversion.h include/vgversion.h.tmp
then
if (VG_(clo_verbosity) <= 1)
VG_(printf)("valgrind-" VERSION "\n");
else
- VG_(printf)("valgrind-" VERSION "-" VGSVN "-vex-" VEXSVN "\n");
+ VG_(printf)("valgrind-" VERSION "-" VGGIT "\n");
VG_(exit)(0);
}