diff --git a/scripts/scm-prompt.sh b/scripts/scm-prompt.sh index c5460683b4..237eacfda3 100644 --- a/scripts/scm-prompt.sh +++ b/scripts/scm-prompt.sh @@ -208,10 +208,13 @@ _scm_prompt() _dotfiles_scm_info() { local fmt + fmt=$1 if [[ -z "$fmt" ]]; then if [[ -n "$WANT_OLD_SCM_PROMPT" ]]; then fmt="%s" + else + fmt=' (%s)' fi fi - _scm_prompt $fmt + _scm_prompt "$fmt" } diff --git a/tests/test-scm-prompt-compat.t b/tests/test-scm-prompt-compat.t index 039ad1153a..49e706c968 100644 --- a/tests/test-scm-prompt-compat.t +++ b/tests/test-scm-prompt-compat.t @@ -26,3 +26,12 @@ Test old mode 5cad84d (no-eol) $ cmd hg book active active (no-eol) + +Test format string + $ oldcmd() { + > "$@" + > _dotfiles_scm_info "g g %s g g\n" + > } + $ hg init repo + $ oldcmd cd repo + g g empty g g