geometry-zsh / geometry

geometry is a minimal, fully customizable and composable zsh prompt theme
ISC License
931 stars 94 forks source link

Silence a git warning in a repo without a HEAD #304

Closed jamescostian closed 3 years ago

jamescostian commented 3 years ago

If you run mkdir x && cd x && git init with geometry prompt, then you'll start seeing this error all the time:

fatal: ambiguous argument 'HEAD': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'

It turns out that error is coming from running git diff-index --quiet HEAD in geometry_git_status and was introduced a few months ago. But that error is actually not a big deal; it's more like a warning given this use case. This commit silences that warning.

jamescostian commented 3 years ago

Hi @frm I just got bit by this bug again after installing on another machine. Would you mind reviewing this 1 line change?