feat(credentials): guard login/submit/logout on credential helper
Problem: if no git credential helper is configured, login and submit silently fail to persist credentials. Solution: add `has_helper()` to `git_credential.lua` that checks `git config credential.helper`. Guard the top of `login()`, `logout()`, and `submit()` with an early-return error. Add a healthcheck warning when no helper is configured. Add LuaCATS annotations to all `git_credential` functions.
This commit is contained in:
parent
8348b6195e
commit
5aa2c024e0
4 changed files with 57 additions and 0 deletions
|
|
@ -84,6 +84,13 @@ local function check()
|
|||
vim.health.warn('git >= 1.7.9 required for credential storage, found ' .. ver_str)
|
||||
end
|
||||
end
|
||||
|
||||
local helper = vim.system({ 'git', 'config', 'credential.helper' }, { text = true }):wait()
|
||||
if helper.code == 0 and helper.stdout and vim.trim(helper.stdout) ~= '' then
|
||||
vim.health.ok('git credential helper: ' .. vim.trim(helper.stdout))
|
||||
else
|
||||
vim.health.warn('no git credential helper configured (required for login/submit)')
|
||||
end
|
||||
else
|
||||
vim.health.warn('git not found (required for credential storage)')
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue