fix(excmd): :trust executed even when inside false condition (#36032)

Problem:  :trust is executed even when inside false condition.
Solution: Make skip_cmd() return true for CMD_trust, as ex_trust() does
          not handle eap->skip itself.
(cherry picked from commit 2f35221774)
This commit is contained in:
zeertzjq
2025-10-05 10:21:44 +08:00
committed by github-actions[bot]
parent 9ce88d5cb9
commit 7304fc275e
3 changed files with 10 additions and 11 deletions

View File

@@ -13,21 +13,21 @@ local fn = n.fn
describe(':trust', function()
local xstate = 'Xstate'
setup(function()
n.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim'))
end)
teardown(function()
n.rmdir(xstate)
end)
before_each(function()
n.mkdir_p(xstate .. pathsep .. (is_os('win') and 'nvim-data' or 'nvim'))
t.write_file('test_file', 'test')
clear { env = { XDG_STATE_HOME = xstate } }
end)
after_each(function()
os.remove('test_file')
n.rmdir(xstate)
end)
it('is not executed when inside false condition', function()
command('edit test_file')
eq('', exec_capture('if 0 | trust | endif'))
eq(nil, vim.uv.fs_stat(fn.stdpath('state') .. pathsep .. 'trust'))
end)
it('trust then deny then remove a file using current buffer', function()