Skip to content

Commit c258fe2

Browse files
authored
fix: don't overwrite debug logging of other packages (#905)
1 parent 6377157 commit c258fe2

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/gitManager/simpleGit.ts

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,19 @@ export class SimpleGit extends GitManager {
8888
process.env[key] = value;
8989
}
9090

91-
debug.enable("simple-git");
91+
const SIMPLE_GIT_NAMESPACE = "simple-git";
92+
const NAMESPACE_SEPARATOR = ",";
93+
const currentDebug = (localStorage.debug ?? "") as string;
94+
const namespaces = currentDebug.split(NAMESPACE_SEPARATOR);
95+
96+
if (
97+
!namespaces.includes(SIMPLE_GIT_NAMESPACE) &&
98+
!namespaces.includes(`-${SIMPLE_GIT_NAMESPACE}`)
99+
) {
100+
namespaces.push(SIMPLE_GIT_NAMESPACE);
101+
debug.enable(namespaces.join(NAMESPACE_SEPARATOR));
102+
}
103+
92104
if (await this.git.checkIsRepo()) {
93105
// Resolve the relative root reported by git into an absolute path
94106
// in case git resides in a different filesystem (eg, WSL)

0 commit comments

Comments
 (0)