question on getversion.sh
rdenham opened this issue · comments
Not really an issue, more of a clarification for me :-)
I came across your repo mostly from trying to work out how to do dynamic versioning in meson builds using dist_script. Your solution is neat, and I'm going to use it in my own project if that's ok.
But I did have a question about the test in line 3:
if [ -n "${MESON_SOURCE_ROOT:-}/.git" ] && VER=$(git -C "$MESON_SOURCE_ROOT" describe); then
Seems to me that the first half will always return a non-zero length string so will always be true. Perhaps it should be:
if [ -d "${MESON_SOURCE_ROOT:-}/.git" ] && VER=$(git -C "$MESON_SOURCE_ROOT" describe); then
?
Anyway, thanks for your solution, hopefully other people will find it useful too.
Oops, thanks for spotting! That's indeed a typo. It's not fatal because git describe
will fail without a .git directory anyway, but it causes an unnecessary error message during building the release tarball. Fixed in PR #211
Note that I used -e
instead of -d
so that this also works with git worktrees.