git-version: fix trunk branch detection

This commit is contained in:
Xi Ruoyao 2021-05-02 16:21:50 +08:00
parent 6ca780c12d
commit 54ee51d41d
No known key found for this signature in database
GPG Key ID: D95E4716CCBB34DC

View File

@ -30,7 +30,7 @@ esac
full_date="$month $day$suffix, $year"
sha="$(git describe --abbrev=1)"
if git describe --all --match trunk > /dev/null 2> /dev/null; then
if [ "$(git branch --show-current)" = "trunk" ]; then
sha=$(echo "$sha" | sed 's/-g[^-]*$//')
fi
version="$sha"