mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
scm-prompt: fix _dotfiles_scm_info
Summary: I was using """_dotfiles_scm_info '[%s] '""" in my prompt, which broke after the refactoring. Add a unit test and fix the code. Test Plan: wrote a test for the breakage, edited code until they all passed Reviewers: rmcelroy, tja Reviewed By: rmcelroy Subscribers: mjpieters, #pe_security Differential Revision: https://phabricator.intern.facebook.com/D4945132 Signature: t1:4945132:1493136425:4516151982d173584cf874985de9de1fed0962d5
This commit is contained in:
parent
63370254c8
commit
094b505444
@ -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"
|
||||
}
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user