Simon Oosthoek <soosthoek@xxxxxxxxxxxx> writes: > On 01/10/12 21:13, Junio C Hamano wrote: > >> Hrm, let me ask a stupid question. Why do we even need __git_ps1_pc >> in the first place? Wouldn't it be just the matter of >> >> PROMPT_COMMAND='__git_ps1 "%s"' >> >> once you have __git_ps1 that works? > > Apart from one small detail, PS1 must be set directly when __git_ps1 is > called as a PROMPT_COMMAND, while in command substitution mode, > __git_ps1 needs to put out a string value to substitute... Now you lost me. The documentation of PROMPT_COMMAND in "man bash" says this: PROMPT_COMMAND If set, the value is executed as a command prior to issuing each primary prompt. So yes, if you say "PROMPT_COMMAND='whatever'", you will get output from 'whatever' followed by what $PS1 would normally give you. If you do not want to see PS1 after 'whatever' gives you, you have to set it to an empty string. On the other hand, they way people have been using __git_ps1 is (as described in the prompt script) to do something like this: PS1='...cruft... $(__git_ps1 "%s") ...cruft...' To keep supporting them, __git_ps1 has to be a function that writes the prompt string to its standard output. The external interface of PROMPT_COMMAND also is that it wants a command that emits the string desired for the prompt to its standard output. I do not see any "when it is used like this, X, but when it is used like that, Y" kind of issue around it, either. So what is the problem???? -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html