fix(worker): First check keys before unsetting them

This commit is contained in:
bkellam 2025-09-01 10:21:08 -04:00
parent 2b423ba7e9
commit 2241217b0b

View file

@ -105,9 +105,14 @@ export const unsetGitConfig = async (path: string, keys: string[], onProgress?:
}).cwd(path);
try {
const configList = await git.listConfig();
const setKeys = Object.keys(configList.all);
for (const key of keys) {
if (setKeys.includes(key)) {
await git.raw(['config', '--unset', key]);
}
}
} catch (error: unknown) {
if (error instanceof Error) {
throw new Error(`Failed to unset git config ${path}: ${error.message}`);