Use a more reliable "in release" checking method

When using a git worktree the repository layout [1] will have a .git file at
the top level with a `gitdir: $path` reference instead of a .git directory, so
check if the .git file or directory exist instead.

[1] https://git-scm.com/docs/gitrepository-layout
2 files changed