Skip to content

Commit

Permalink
Nullify settings if empty string is passed
Browse files Browse the repository at this point in the history
  • Loading branch information
CKolkey committed Oct 9, 2023
1 parent f768a3a commit a82a7c8
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions lua/neogit/lib/state.lua
Original file line number Diff line number Diff line change
Expand Up @@ -79,15 +79,21 @@ local function gen_key(key_table)
end

---Set option and write to disk
---@param key table
---@param key string[]
---@param value any
function M.set(key, value)
if not M.enabled() then
return
end

if not vim.tbl_contains(config.values.ignored_settings, gen_key(key)) then
M.state[gen_key(key)] = value
local cache_key = gen_key(key)
if not vim.tbl_contains(config.values.ignored_settings, cache_key) then
if value == "" then
M.state[cache_key] = nil
else
M.state[cache_key] = value
end

M.write()
end
end
Expand Down

0 comments on commit a82a7c8

Please sign in to comment.