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:
Barrett Ruth 2026-03-07 19:50:04 -05:00
parent 8348b6195e
commit 5aa2c024e0
Signed by: barrett
GPG key ID: A6C96C9349D2FC81
4 changed files with 57 additions and 0 deletions

View file

@ -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