agkozak / polyglot

Color, ASCII-only Git prompt for zsh, bash, ksh93, mksh, pdksh, oksh, dash, yash, busybox ash, and osh
MIT License
179 stars 13 forks source link

Bugfixes #1

Closed Phoenix4815 closed 7 years ago

Phoenix4815 commented 7 years ago

This pull request fixes two bugs I encountered after cloning the project.

  1. If you're running a root shell (that is, $EUID equals 0),
    case $EUID in
      0)
        case $(ps -o comm= -p $PPID) in
          sshd|*/sshd) return 0 ;;
        esac
        ;;

    will return 0, although the current shell is not an ssh shell at all! My first commit fixes this.

Secondly, the _branch_changes() relies on git's output. This does not work, however, if git's default language is not English. Setting LC_ALL=C before the git command fixes this.

agkozak commented 7 years ago

These are very thoughtful and elegant fixes. Many thanks! I shall merge them.