diff --git a/contrib/completion/git-prompt.sh b/contrib/completion/git-prompt.sh index 6186c474ba71e1..4a64aca3edaa0f 100644 --- a/contrib/completion/git-prompt.sh +++ b/contrib/completion/git-prompt.sh @@ -147,7 +147,7 @@ printf -v __git_printf_supports_v -- '%s' yes >/dev/null 2>&1 # like __git_SOH=$'\001' etc but works also in shells without $'...' eval "$(printf ' - __git_SOH="\001" __git_STX="\002" __git_ESC="\033" + __git_SOH="\\001" __git_STX="\\002" __git_ESC="\033" __git_LF="\n" __git_CRLF="\r\n" ')" diff --git a/t/t9903-bash-prompt.sh b/t/t9903-bash-prompt.sh index d667dda654e2de..fc6fdd36c69de2 100755 --- a/t/t9903-bash-prompt.sh +++ b/t/t9903-bash-prompt.sh @@ -13,10 +13,10 @@ export GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME . "$GIT_BUILD_DIR/contrib/completion/git-prompt.sh" actual="$TRASH_DIRECTORY/actual" -c_red='\001\e[31m\002' -c_green='\001\e[32m\002' -c_lblue='\001\e[1;34m\002' -c_clear='\001\e[0m\002' +c_red='\\001\e[31m\\002' +c_green='\\001\e[32m\\002' +c_lblue='\\001\e[1;34m\\002' +c_clear='\\001\e[0m\\002' test_expect_success 'setup for prompt tests' ' git init otherrepo &&