Closed whwright closed 5 years ago
Any interest in this?
How do you reproduce the erroneous case?
~ 1% cd $(mktemp -d)
/tmp/tmp.ZFXcapLMo6% git init
Initialized empty Git repository in /tmp/tmp.ZFXcapLMo6/.git/
/tmp/tmp.ZFXcapLMo6 (master L|✔)% cd .
/tmp/tmp.ZFXcapLMo6 (master L|✔)% git status
On branch master
No commits yet
nothing to commit (create/copy files and use "git add" to track)
/tmp/tmp.ZFXcapLMo6 (master L|✔) 126% git status --porcelain --branch | ~/src/zsh-git-prompt/gitstatus.py
master 0 0 0 0 0 0 0 1 .. 0 0%
looks fine to me!
This should work (I'm currently using my fork locally, but can confirm later):
↪ git clone git@github.com:whwright/empty-repo.git
Cloning into 'empty-repo'...
warning: You appear to have cloned an empty repository.
↪ cd empty-repo
Yes I still get the error on master
branch of this repo (using my public empty-repo
)
↪ cd empty-repo
git_super_status:[:23: integer expression expected: yet
git_super_status:[:23: integer expression expected: commits
git_super_status:[:26: integer expression expected: yet
git_super_status:[:29: integer expression expected: commits
git_super_status:[:35: integer expression expected: on
git_super_status:[:39: integer expression expected: master
yep, reproduced. thanks!
Hmm, this seems like a bug with https://github.com/starcraftman/zsh-git-prompt/blob/11b83ba3b85d14c66cf2ab79faefab6d838da28e/gitstatus.py#L97-L98
@whwright see if https://github.com/starcraftman/zsh-git-prompt/pull/37 fixes it for you. I think that's a better fix.
Ah good find. I admittedly was debugging the bash and not the python.
It appears that it is because
↪ cd empty-repo
↪ git status --branch --porcelain
## No commits yet on master...origin/master [gone]
has the ...
first and the first if statement is executed
Yep. We've come to the same conclusion :)
Yes I agree your solution is much cleaner. Thanks for taking a look.
Fix for https://github.com/starcraftman/zsh-git-prompt/issues/31