Re: [PATCH] git-prompt: changes == to = for zsh's sake

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



At 23:17 +0000 20 Jul 2020, "David J. Malan via GitGitGadget" <gitgitgadget@xxxxxxxxx> wrote:
From: "David J. Malan" <malan@xxxxxxxxxxx>

When using git-prompt.sh with Zsh, __git_ps1 currently errs
when inside a repo with:

__git_ps1:96: = not found

That depends if zsh's `equals` option is set or not. If it's set (as it is by default) you'll get that behavior. If it's unset (`setopt no_equals`) that should behave as in bash. But, it fixing the code to work regardless of shell options is definitely a good thing.

This commit changes `==` to `=` for both Bash and Zsh.

An alternate fix would be to switch to using double square brackets instead of single square brackets for the test. Since contents of double brackets have their own parsing rules the `equals` option doesn't apply there, and so `==` is available for checking equality same as in bash. IMHO, this provides saner behavior in general; although it's definitely not POSIX compliant.



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux