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 59 seconds (queued for 3 seconds)
Status Job ID Name Coverage
  Build
passed #11774
docker
autoconf

00:04:52

passed #11775
docker
cmake

00:02:05

passed #11776
docker
meson

00:02:46

 
  Test
passed #11777
docker
whitespace

00:00:05