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 5 minutes and 18 seconds (queued for 2 seconds)
Status Job ID Name Coverage
  Build
passed #11704
docker
autoconf

00:04:26

passed #11705
docker
cmake

00:02:03

passed #11706
docker
meson

00:02:17

 
  Test
passed #11707
docker
whitespace

00:00:06