starcraftman / zsh-git-prompt

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

[exception] invalid literal for int() #20

Closed ghost closed 6 years ago

ghost commented 6 years ago

on gitstatus.py

Exception in line of 118 on "parse_ahead_behind()"

else:
    behind = int(part.replace('behind ', ''))

'part' has 'ahead', 'behind' and 'gone'.

if gone, don't run line of 118.

elif 'behind' in part:
    behind = int(part.replace('behind ', ''))
starcraftman commented 6 years ago

Ah, interesting. Gone means some commits have been simply trimmed from the remote then as opposed to diverging? Simple enough fix, will get on that.

starcraftman commented 6 years ago

I don't see gone in the git status documentation, can you tell me steps to reproduce? Do I just drop a commit in the middle of remotes history? I'd like to add test case even though fix is indeed trivial.

starcraftman commented 6 years ago

Ok, I looked at git source and replicated the issue. Happens when the local branch x is tracking remote/x, then delete remote/x. The upstream itself is 'gone'. Captured output:

## w...up/w [gone]

I will fix it and add a test. I wonder now if we should add some indicator that upstream was deleted? For now will just silently continue functioning.