Simon Oosthoek <s.oosthoek@xxxxxxxxx> writes: > The optional third parameter when __git_ps1 is used in > PROMPT_COMMAND mode as format string for printf to further > customize the way the git status string is embedded in the > user's PS1 prompt. > > Signed-off-by: Simon Oosthoek <s.oosthoek@xxxxxxxxx> > --- Thanks. If we do not care about the existing users (and in this case, because PROMPT_COMMAND mode is in no released version, we could declare there is no existing user), another and simpler approach is to just drop " (" and ")" altogether and have the user give these as part of the pre/post strings. Or we could go the other way and drop "pre/post" strings, making them part of the printf_format string. Perhaps that might be a better interface in the longer term. Then people can use the same "<pre>%s<post>" format string and do either of these: PS1=$(__git_ps1 "<pre>%s<post>") PROMPT_COMMAND='PS1=$(__git_ps1 "<pre>%s<post>")' without __git_ps1 having a special "prompt command" mode, no? I have a feeling that I am missing something major, though... > if [ "$w" = "*" ]; then > - PS1="$PS1\[$bad_color\]$w" > + gitstring="$gitstring\[$bad_color\]$w" > fi Every time I looked at this line, I wondered why '*' state is "bad". Does a user go into any "bad" state by having a dirty working tree? Same for untracked ($u) and detached. These are all perfectly normal part of a workflow, so while choice of red may be fine to attract attention, calling it "bad" sounds misguided. -- 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