Skip to content

Commit 4f9cb67

Browse files
committed
move unset to finally in fetch
1 parent 397c430 commit 4f9cb67

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

packages/backend/src/git.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -78,10 +78,6 @@ export const fetchRepository = async (
7878
"--prune",
7979
"--progress"
8080
]);
81-
82-
if (authHeader) {
83-
await git.raw(["config", "--unset", "http.extraHeader", authHeader]);
84-
}
8581
} catch (error: unknown) {
8682
const baseLog = `Failed to fetch repository: ${path}`;
8783
if (env.SOURCEBOT_LOG_LEVEL !== "debug") {
@@ -92,6 +88,16 @@ export const fetchRepository = async (
9288
} else {
9389
throw new Error(`${baseLog}. Error: ${error}`);
9490
}
91+
} finally {
92+
if (authHeader) {
93+
const git = simpleGit({
94+
progress: onProgress,
95+
}).cwd({
96+
path: path,
97+
})
98+
99+
await git.raw(["config", "--unset", "http.extraHeader", authHeader]);
100+
}
95101
}
96102
}
97103

0 commit comments

Comments
 (0)