starcraftman / zsh-git-prompt

[Active Fork] Informative git prompt for zsh
MIT License
58 stars 15 forks source link

Improve git dir detection #36

Open jpo-joyent opened 5 years ago

jpo-joyent commented 5 years ago

Before this change, when cding into a .git directory, you would see the following on every prompt:

git_super_status:[:18: integer expression expected: work
git_super_status:[:28: integer expression expected: operation
git_super_status:[:28: integer expression expected: this
git_super_status:[:31: integer expression expected: operation
git_super_status:[:34: integer expression expected: this
git_super_status:[:40: integer expression expected: must
git_super_status:[:44: integer expression expected: be
git_super_status:[:48: integer expression expected: run
git_super_status:[:52: integer expression expected: in
git_super_status:[:56: integer expression expected: a

After this change, the python script is only run iff git status returns zero, and stderr is discarded.

This also has the nice side-effect of speeding up prompts while cding between dirs that are not in a git repo.