oh-my-fish / theme-agnoster

MIT License
95 stars 64 forks source link

Git symbol shown all the time in prompt #5

Closed gibbling closed 8 years ago

gibbling commented 9 years ago

Hello,

I recently updated omf and after installing agnoster I see the git section of the prompt always. If I enter an actual repo it shows a second git in the prompt with the name of the branch. I tried deleting the downloaded theme from the omf themes folder and rerunning omf install to pull it down but it is a persistent problem.

screen shot 2015-08-11 at 2 04 50 am
gibbling commented 9 years ago

installing bobthefish which is similiar in appearance will only show current directory in the prompt unless its a git repo. Not sure that helps narrow anything down.

gibbling commented 9 years ago

no those are still commented on the agnoster fish_prompt.fish

gibbling commented 9 years ago

Same result just with user and machine name included before working dir.

sn0cr commented 9 years ago

I just had a look into the theme again, debugged a bit and found that this change was introduced with PR #3

sn0cr commented 9 years ago

have a look at this gist, hopefully it solves the problem :smiley: https://gist.github.com/sn0cr/44d9351d3ccb365a0bfc

gibbling commented 9 years ago

Using that gist instead has solved the problem. I wonder if this would of been an present if I didn't have svn installed.

bpinto commented 9 years ago

@sn0cr Does that gist fix the issue or just "rollback" the changes?

gibbling commented 9 years ago

I reverted back to the original fish_prompt.fish after manually gutting svn from osx and the persistent prompt was not present. I then installed svn via homebrew and it returned.

I dont want to speak for @sn0cr but it looks like from this diff it just doesn't merge the "if type" and "if command" as one statement. Looks like this was the original fix mentioned here https://github.com/oh-my-fish/theme-agnoster/issues/3#issuecomment-125811592

<   if type svn >/dev/null 2>&1
<     if command svn ls . >/dev/null 2>&1
<       set branch (svn_get_branch)
<       set branch_symbol \uE0A0
<       set revision (svn_get_revision)
<       prompt_segment green black "$branch_symbol $branch:$revision"
<     end
---
>   if type svn >/dev/null 2>&1; and command svn ls . >/dev/null 2>&1
>     set branch (svn_get_branch)
>     set branch_symbol \uE0A0
>     set revision (svn_get_revision)
>     prompt_segment green black "$branch_symbol $branch:$revision"
sn0cr commented 9 years ago

Indeed - the 'and' did cause the persistent segment @bpinto it's a partly rollback - the nested if does solve the issue here - but I don't know why...

bpinto commented 9 years ago

I see, submit a PR @sn0cr?

sn0cr commented 8 years ago

I think this has been fixed. Closing this for now.