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
|
|
@ -42,6 +42,14 @@ end
|
|||
|
||||
---@param opts { language?: string }?
|
||||
function M.submit(opts)
|
||||
if not git_credential.has_helper() then
|
||||
logger.log(
|
||||
'No git credential helper configured. See :help cp-credentials',
|
||||
{ level = vim.log.levels.ERROR }
|
||||
)
|
||||
return
|
||||
end
|
||||
|
||||
local platform = state.get_platform()
|
||||
local contest_id = state.get_contest_id()
|
||||
local problem_id = state.get_problem_id()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue