Skip to content

Commit 5e28ff7

Browse files
committed
Use vscode.workspace.rootPath to construct SimpleGit instance.
Allows per-workspace git user and email address.
1 parent a5b5d32 commit 5e28ff7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/GitConfig.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
import simpleGit, {ConfigValues, SimpleGit} from "simple-git";
1+
import simpleGit, { ConfigValues, SimpleGit } from "simple-git";
2+
import { workspace } from "vscode";
23

34
export default class GitConfig {
45
private gitConfig: ConfigValues;
56

67
public constructor() {
7-
const git: SimpleGit = simpleGit();
8+
const baseDir = workspace.workspaceFolders?.[0].uri.fsPath;
9+
const git: SimpleGit = simpleGit(baseDir);
810
git.listConfig().then((result) => {
911
this.gitConfig = result.all;
1012
});

0 commit comments

Comments
 (0)