MCPcopy Index your code
hub / github.com/sourcebot-dev/sourcebot / upsertGitConfig

Function upsertGitConfig

packages/backend/src/git.ts:183–208  ·  view source on GitHub ↗
(
    {
        path,
        gitConfig,
        onProgress,
        signal,
    }: {
        path: string,
        gitConfig: Record<string, string>,
        onProgress?: onProgressFn,
        signal?: AbortSignal
    })

Source from the content-addressed store, hash-verified

181 * present in gitConfig.
182 */
183export const upsertGitConfig = async (
184 {
185 path,
186 gitConfig,
187 onProgress,
188 signal,
189 }: {
190 path: string,
191 gitConfig: Record<string, string>,
192 onProgress?: onProgressFn,
193 signal?: AbortSignal
194 }) => {
195 const git = createGitClientForPath(path, onProgress, signal);
196
197 try {
198 for (const [key, value] of Object.entries(gitConfig)) {
199 await git.addConfig(key, value);
200 }
201 } catch (error: unknown) {
202 if (error instanceof Error) {
203 throw new Error(`Failed to set git config ${path}: ${error.message}`);
204 } else {
205 throw new Error(`Failed to set git config ${path}: ${error}`);
206 }
207 }
208}
209
210/**
211 * Unsets the specified keys in the git config for the repo at the given path.

Callers 1

indexRepositoryMethod · 0.85

Calls 1

createGitClientForPathFunction · 0.85

Tested by

no test coverage detected