edkolev / promptline.vim

Generate a fast shell prompt with powerline symbols and airline colors
MIT License
623 stars 54 forks source link

If there is '/' contain in git branch name, vcs_branch show incorrect branch name. #69

Closed mob5566 closed 6 years ago

mob5566 commented 6 years ago

If there is '/' contain in git branch name, vcs_branch will show only the parts of brach name after last '/'. I think the root cause is using branch=${branch##*/} in promptline#slices#vcs_branch#function_body. Would you fix this condition?

tysonclugg commented 6 years ago

According to the POSIX Shell specification, ${branch##*/} will remove the largest prefix pattern matching */.

I'm guessing that removing the smallest prefix pattern would suit your needs better, the pattern for that being ${branch#*/}. Have you tried this? If it works for you, maybe submit a pull request?

mob5566 commented 6 years ago

Hi @tysonclugg, thank you for your response!

I think the original pattern is correct for the normal condition. If the result of git symbolic-ref --quiet HEAD is refs/heads/master, that works correctly. But if I have a branch named test/dev, that would be refs/heads/test/dev and only dev was showed. I think that slash is inappropriate for being a delimiter in the branch name. Therefore, I decide to close this issue.

Thank you all.