(
cmd: string,
cred: Map<string, string>,
path: string,
env: Record<string, string | undefined> = {}
)
| 49 | |
| 50 | // Can't use git() as that will call withTrampolineEnv which calls this method |
| 51 | const exec = ( |
| 52 | cmd: string, |
| 53 | cred: Map<string, string>, |
| 54 | path: string, |
| 55 | env: Record<string, string | undefined> = {} |
| 56 | ) => |
| 57 | git( |
| 58 | [ |
| 59 | ...['-c', 'credential.helper='], |
| 60 | ...['-c', `credential.helper=manager`], |
| 61 | 'credential', |
| 62 | cmd, |
| 63 | ], |
| 64 | path, |
| 65 | { |
| 66 | stdin: formatCredential(cred), |
| 67 | env: { |
| 68 | GIT_TERMINAL_PROMPT: '0', |
| 69 | GIT_ASKPASS: '', |
| 70 | TERM: 'dumb', |
| 71 | ...env, |
| 72 | }, |
| 73 | } |
| 74 | ).then(({ exitCode, stderr, stdout }) => { |
| 75 | if (exitCode !== 0) { |
| 76 | throw new Error(stderr) |
| 77 | } |
| 78 | return parseCredential(stdout) |
| 79 | }) |
| 80 | |
| 81 | export const fillCredential = exec.bind(null, 'fill') |
| 82 | export const approveCredential = exec.bind(null, 'approve') |
no test coverage detected