Skip to content

Commit 4b8d88b

Browse files
committed
Allow disabling integrated askpass
The GIT_ASKPASS variable is currently enforced by vscode and there is no way to overwrite it. This commit adds an options to disable the integrated askpass and use your own. Fixes #111839
1 parent 59e8f97 commit 4b8d88b

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

extensions/git/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2171,6 +2171,11 @@
21712171
"default": false,
21722172
"description": "%config.useCommitInputAsStashMessage%"
21732173
},
2174+
"git.useIntegratedAskPass": {
2175+
"type": "boolean",
2176+
"default": true,
2177+
"description": "%config.useIntegratedAskPass%"
2178+
},
21742179
"git.githubAuthentication": {
21752180
"deprecationMessage": "This setting is now deprecated, please use `github.gitAuthentication` instead."
21762181
},

extensions/git/package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@
193193
"config.showUnpublishedCommitsButton.whenEmpty": "Only shows the action button if there are no other changes and there are unpublished commits.",
194194
"config.showUnpublishedCommitsButton.never": "Never shows the action button.",
195195
"config.statusLimit": "Controls how to limit the number of changes that can be parsed from Git status command. Can be set to 0 for no limit.",
196+
"config.useIntegratedAskPass": "Controls whether GIT_ASKPASS should be overwritten to use the integrated version.",
196197
"submenu.explorer": "Git",
197198
"submenu.commit": "Commit",
198199
"submenu.commit.amend": "Amend",

extensions/git/src/askpass.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,19 @@ export class Askpass implements IIPCHandler {
7979
};
8080
}
8181

82-
return {
82+
let env: { [key: string]: string; } = {
8383
...this.ipc.getEnv(),
84-
GIT_ASKPASS: path.join(__dirname, 'askpass.sh'),
8584
VSCODE_GIT_ASKPASS_NODE: process.execPath,
8685
VSCODE_GIT_ASKPASS_EXTRA_ARGS: (process.versions['electron'] && process.versions['microsoft-build']) ? '--ms-enable-electron-run-as-node' : '',
8786
VSCODE_GIT_ASKPASS_MAIN: path.join(__dirname, 'askpass-main.js')
8887
};
88+
89+
const config = workspace.getConfiguration('git');
90+
if (config.get<boolean>('useIntegratedAskPass')) {
91+
env.GIT_ASKPASS = path.join(__dirname, 'askpass.sh');
92+
}
93+
94+
return env;
8995
}
9096

9197
registerCredentialsProvider(provider: CredentialsProvider): Disposable {

0 commit comments

Comments
 (0)