scm-prompt: fix single quotes showing up with no format string

Summary: Regression that wasn't tested by the tests before

Test Plan: This is now tested with a new test

Reviewers: #fbhgext, mjpieters

Reviewed By: mjpieters

Differential Revision: https://phab.mercurial-scm.org/D823
This commit is contained in:
Ryan McElroy 2017-09-27 06:43:51 -07:00
parent 3add344955
commit 59d15d70c8
2 changed files with 5 additions and 1 deletions

View File

@ -193,7 +193,7 @@ _scm_prompt() {
# - provide a space for the user so that they don't have to have # - provide a space for the user so that they don't have to have
# random extra spaces in their prompt when not in a repo # random extra spaces in their prompt when not in a repo
# - provide parens so it's differentiated from other crap in their prompt # - provide parens so it's differentiated from other crap in their prompt
fmt="${1:-' (%s)'}" fmt="${1:- (%s)}"
# find out if we're in a git or hg repo by looking for the control dir # find out if we're in a git or hg repo by looking for the control dir
dir="$PWD" dir="$PWD"

View File

@ -35,3 +35,7 @@ Test format string
$ hg init repo $ hg init repo
$ oldcmd cd repo $ oldcmd cd repo
g g empty g g g g empty g g
Test main prompt with no format string
$ _scm_prompt
(empty) (no-eol)