On 2024-04-25 at 18:59:51, Thomas via GitGitGadget wrote: > From: Thomas Queiroz > > Since GIT_PS1_SHOWUPSTREAM is a variable with space separated values and > zsh for loops do no split by space by default, parsing of the options > wasn't actually being done. The `-d' '` is a hacky solution that works > in both bash and zsh. The correct way to do that in zsh would be do use > read -rA and loop over the resulting array but -A isn't defined in bash. I wonder if it might actually be better to adjust the shell options when we call into __git_ps1. We could write this like so: [ -z "${ZSH_VERSION-}" ] || setopt localoptions shwordsplit That will turn on shell word splitting for just that function (and the functions it calls), so the existing code will work fine and we won't tamper with the user's preferred shell options. My concern is that changing the way we write the code here might result in someone unintentionally changing it back because it's less intuitive. By specifically asking zsh to use shell word splitting, we get consistent behaviour between bash and zsh, which is really what we want anyway. I use the above syntax (minus the shell check) in my zsh prompt and can confirm it works as expected. -- brian m. carlson (they/them or he/him) Toronto, Ontario, CA