Richard Hansen <> writes:

> Not all shells subject the prompt string to parameter expansion.  Test
> whether the shell will expand the value of PS1, and use the result to
> control whether raw ref names are included directly in PS1.
> This fixes a regression introduced in commit 8976500 ("
> don't put unsanitized branch names in $PS1"):  zsh does not expand PS1
> by default, but that commit assumed it did.  The bug resulted in
> prompts containing the literal string '${__git_ps1_branch_name}'
> instead of the actual branch name.
> Reported-by: Caleb Thompson <>
> Signed-off-by: Richard Hansen <>
> ---

Thanks, applied.

> To prevent a regression like this from happening again, I plan on
> adding new zsh test cases and expanding the bash test cases (to test
> the behavior with 'shopt -u promptvars').  I'd like the zsh tests to
> cover the same stuff as the bash tests.  These are the steps I am
> considering:
>   1. delete the last test case in t9903 ("prompt - zsh color pc mode")
>   2. add two new functions to t/
>          ps1_expansion_enable () { shopt -s promptvars; }
>          ps1_expansion_disable () { shopt -u promptvars; }
>   3. loop over the relevant test cases twice:  once after calling
>      ps1_expansion_enable and once after calling ps1_expansion_disable
>      (with appropriate adjustments to the expected output)
>   4. move the test cases in t9903 to a separate library file and
>      source it from
>   5. create two new files:
>        * t/ (same as t/ but tweaked for zsh)
>        * t/ (same as t/ but
>          tweaked for zsh)
> Does this approach sound reasonable?

Sounds like a plan, especially if step 4 does a reasonable job of
factoring out as much common stuff as possible.
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to
More majordomo info at

Reply via email to