MCPcopy
hub / github.com/desktop/desktop / exec

Function exec

app/src/lib/git/credential.ts:51–79  ·  view source on GitHub ↗
(
  cmd: string,
  cred: Map<string, string>,
  path: string,
  env: Record<string, string | undefined> = {}
)

Source from the content-addressed store, hash-verified

49
50// Can't use git() as that will call withTrampolineEnv which calls this method
51const 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
81export const fillCredential = exec.bind(null, 'fill')
82export const approveCredential = exec.bind(null, 'approve')

Callers 15

createRepositoryFunction · 0.85
setupConflictedRepoFunction · 0.85
setupLocalConfigFunction · 0.85
cloneRepositoryFunction · 0.85
makeCommitFunction · 0.85
createBranchFunction · 0.85
switchToFunction · 0.85
cloneLocalRepositoryFunction · 0.85

Calls 3

formatCredentialFunction · 0.85
parseCredentialFunction · 0.85
gitFunction · 0.70

Tested by

no test coverage detected