support git worktree checkouts
BUG: 374478
CHANGELOG: Auto-detect git worktree checkouts by allowing .git to be a file, too