Skip to content

Commit

Permalink
#149 New setting git-graph.integratedTerminalShell allows a specific …
Browse files Browse the repository at this point in the history
…Shell (not the default) to be used by the Visual Studio Code Integrated Terminal, when opened by Git Graph during Interactive Rebase's.
  • Loading branch information
mhutchie committed Aug 1, 2019
1 parent 0749aaf commit a5c22fd
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,12 @@
"default": 300,
"description": "Specifies the number of commits to initially load."
},
"git-graph.integratedTerminalShell": {
"type": "string",
"default": "",
"description": "Specifies the path and filename of the Shell executable to be used by the Visual Studio Code Integrated Terminal, when opened by Git Graph during Interactive Rebase's. For example, to use Git Bash on Windows this setting would commonly be set to \"C:\\Program Files\\Git\\bin\\bash.exe\". If this setting is left blank, the default Shell is used.",
"scope": "machine"
},
"git-graph.loadMoreCommits": {
"type": "number",
"default": 100,
Expand Down
4 changes: 4 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,10 @@ class Config {
return this.config.get('initialLoadCommits', 300);
}

public integratedTerminalShell() {
return this.config.get('integratedTerminalShell', '');
}

public loadMoreCommits() {
return this.config.get('loadMoreCommits', 75);
}
Expand Down
6 changes: 5 additions & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,11 @@ export function runGitCommandInNewTerminal(cwd: string, gitPath: string, command
if (p !== '' && !p.endsWith(sep)) p += sep;
p += path.dirname(gitPath);

let terminal = vscode.window.createTerminal({ cwd: cwd, name: name, env: { 'PATH': p } });
let options: vscode.TerminalOptions = { cwd: cwd, name: name, env: { 'PATH': p } };
let shell = getConfig().integratedTerminalShell();
if (shell !== '') options.shellPath = shell;

let terminal = vscode.window.createTerminal(options);
terminal.sendText('git ' + command);
terminal.show();
}
Expand Down

0 comments on commit a5c22fd

Please sign in to comment.