From 63bba04778aa698e83eb7f8a06beb3815d4ed46c Mon Sep 17 00:00:00 2001 From: Wen Hui Date: Thu, 25 Feb 2021 13:08:24 -0500 Subject: [PATCH] redis-cli prompt: fix db number and transaction state inconsistencies after reconnect (#8551) After reconnect, the prompt was showing the db ID and multi state of the previous connection. --- src/redis-cli.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/redis-cli.c b/src/redis-cli.c index ef1d49e3e..3930a2d8e 100644 --- a/src/redis-cli.c +++ b/src/redis-cli.c @@ -819,6 +819,9 @@ static int cliConnect(int flags) { if (context == NULL || flags & CC_FORCE) { if (context != NULL) { redisFree(context); + config.dbnum = 0; + config.in_multi = 0; + cliRefreshPrompt(); } if (config.hostsocket == NULL) {