MCPcopy Create free account
hub / github.com/isomorphic-git/isomorphic-git / setConfig

Function setConfig

src/api/setConfig.js:52–79  ·  view source on GitHub ↗
({
  fs: _fs,
  dir,
  gitdir = join(dir, '.git'),
  path,
  value,
  append = false,
})

Source from the content-addressed store, hash-verified

50 * console.log(file)
51 */
52export async function setConfig({
53 fs: _fs,
54 dir,
55 gitdir = join(dir, '.git'),
56 path,
57 value,
58 append = false,
59}) {
60 try {
61 assertParameter('fs', _fs)
62 assertParameter('gitdir', gitdir)
63 assertParameter('path', path)
64 // assertParameter('value', value) // We actually allow 'undefined' as a value to unset/delete
65
66 const fs = new FileSystem(_fs)
67 const updatedGitdir = await discoverGitdir({ fsp: fs, dotgit: gitdir })
68 const config = await GitConfigManager.get({ fs, gitdir: updatedGitdir })
69 if (append) {
70 await config.append(path, value)
71 } else {
72 await config.set(path, value)
73 }
74 await GitConfigManager.save({ fs, gitdir: updatedGitdir, config })
75 } catch (err) {
76 err.caller = 'git.setConfig'
77 throw err
78 }
79}

Calls 7

joinFunction · 0.90
assertParameterFunction · 0.90
discoverGitdirFunction · 0.90
appendMethod · 0.80
saveMethod · 0.80
getMethod · 0.45
setMethod · 0.45

Tested by 2

addUserConfigFunction · 0.68
addUserConfigFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…