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 autoconf #11784
docker

00:04:50

passed cmake #11785
docker

00:02:05

passed meson #11786
docker

00:02:22

 
  Test
passed whitespace #11787
docker

00:00:05