From c4e20846e176443dc096f2718c360894a7add472 Mon Sep 17 00:00:00 2001 From: mortezadadgar Date: Wed, 13 Dec 2023 22:53:29 +0330 Subject: [PATCH] Unconditionally disable switch when input is empty this can results in empty user input being passed to git cli where a non-empty string was needed. --- lua/neogit/lib/popup/init.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/neogit/lib/popup/init.lua b/lua/neogit/lib/popup/init.lua index 549b374a2..2a7daccb1 100644 --- a/lua/neogit/lib/popup/init.lua +++ b/lua/neogit/lib/popup/init.lua @@ -249,8 +249,10 @@ function M:toggle_switch(switch) if switch.user_input then if switch.enabled then local value = input.get_user_input(switch.cli_prefix .. switch.cli_base .. ": ") - if value then + if value ~= "" then switch.cli = switch.cli_base .. value + else + switch.enabled = false end else switch.cli = switch.cli_base