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 8 minutes and 19 seconds (queued for 1 minute and 6 seconds)
Status Job ID Name Coverage
  Build
passed #11696
docker
autoconf

00:04:35

passed #11697
docker
cmake

00:01:56

passed #11698
docker
meson

00:02:35

 
  Test
passed #11699
docker
whitespace

00:00:05