Revision def68323ad79a7852c80b8901d0ea68dcc429a98 authored by Gautier Hattenberger on 27 February 2019, 19:25:20 UTC, committed by Freek van Tienen on 28 February 2019, 13:26:52 UTC
1 parent 8e4029c
Raw File
paparazzi_version
#!/bin/sh

DEF_VER=v5.15_devel

# First try git describe (if running on a git repo),
# then use default version from above (for release tarballs).
if test -d .git -o -f .git
then
    # if a commandline argument was given, assume it was a ref that git can interpret
    if [ "$#" -ne 0 ]; then
        GIT_VN=$(git describe --match "v[0-9].[0-9]*" --always --long $*)
    else
        GIT_VN=$(git describe --match "v[0-9].[0-9]*" --dirty --always --long)
    fi
    if echo "$GIT_VN" | grep -Eq "^v[0-9].[0-9]"
    then
        VN="$GIT_VN"
    else
        VN="$DEF_VER"-none-g"$GIT_VN"
    fi
else
    VN="$DEF_VER"
fi

echo $VN
back to top