The command was using this to check for git repo context:
git rev-parse --is-inside-work-tree
With this change, this is used instead:
git rev-parse --git-dir
The latter approach works in the context of a bare git repository, which does not have a worktree.