Skip to content

Commit 637ae90

Browse files
authored
Merge pull request #500 from fcollonval/fix-494-cmd-execution
Remove the `cmd` argument in open terminal
2 parents 372dba5 + 0f754d8 commit 637ae90

File tree

2 files changed

+10
-29
lines changed

2 files changed

+10
-29
lines changed

src/gitMenuCommands.ts

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,33 +28,25 @@ export function addCommands(
2828
const { commands, shell } = app;
2929

3030
/**
31-
* Add open terminal and run command
32-
*
33-
* Argument 'cmd' can be passed at the execute function to specify the command to execute
31+
* Add open terminal in the Git repository
3432
*/
3533
commands.addCommand(CommandIDs.gitTerminalCommand, {
36-
label: 'Git Command in Terminal',
37-
caption: 'Open a new terminal to perform git command',
34+
label: 'Open Terminal in Git Repository',
35+
caption: 'Open a New Terminal in the Git Repository',
3836
execute: async args => {
39-
let changeDirectoryCommand =
40-
model.pathRepository === null
41-
? ''
42-
: 'cd "' + model.pathRepository.split('"').join('\\"') + '"';
43-
let gitCommand = (args['cmd'] as string) || '';
44-
let linkCommand =
45-
changeDirectoryCommand !== '' && gitCommand !== '' ? '&&' : '';
46-
4737
const main = (await commands.execute(
4838
'terminal:create-new',
4939
args
5040
)) as MainAreaWidget<ITerminal.ITerminal>;
5141

52-
const terminal = main.content;
5342
try {
54-
terminal.session.send({
55-
type: 'stdin',
56-
content: [changeDirectoryCommand + linkCommand + gitCommand + '\n']
57-
});
43+
if (model.pathRepository !== null) {
44+
const terminal = main.content;
45+
terminal.session.send({
46+
type: 'stdin',
47+
content: [`cd "${model.pathRepository.split('"').join('\\"')}"\n`]
48+
});
49+
}
5850

5951
return main;
6052
} catch (e) {

src/model.ts

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -681,17 +681,6 @@ export class GitExtension implements IGitExtension {
681681
}
682682
}
683683

684-
performDiff(filename: string, revisionA: string, revisionB: string) {
685-
let extension = PathExt.extname(filename).toLocaleLowerCase();
686-
if (this._diffProviders[extension] !== undefined) {
687-
this._diffProviders[extension](filename, revisionA, revisionB);
688-
} else if (this.commands) {
689-
this.commands.execute('git:terminal-cmd', {
690-
cmd: 'git diff ' + revisionA + ' ' + revisionB
691-
});
692-
}
693-
}
694-
695684
/**
696685
* Register a new diff provider for specified file types
697686
*

0 commit comments

Comments
 (0)