meson: fix get-version script for git worktrees

For git worktree directories .git is not a directory
but a file that points to the real .git dir.
4 jobs for meson-get-version-git-worktree in 4 minutes and 55 seconds (queued for 1 second)
latest
Status Job ID Name Coverage
  Build
passed #11784
docker
autoconf

00:04:50

passed #11785
docker
cmake

00:02:05

passed #11786
docker
meson

00:02:22

 
  Test
passed #11787
docker
whitespace

00:00:05