Skip to content

Commit 9de1ed8

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 72ef0f3 commit 9de1ed8

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
@@ -2189,6 +2189,11 @@
21892189
"default": false,
21902190
"description": "%config.useCommitInputAsStashMessage%"
21912191
},
2192+
"git.useIntegratedAskPass": {
2193+
"type": "boolean",
2194+
"default": true,
2195+
"description": "%config.useIntegratedAskPass%"
2196+
},
21922197
"git.githubAuthentication": {
21932198
"deprecationMessage": "This setting is now deprecated, please use `github.gitAuthentication` instead."
21942199
},

extensions/git/package.nls.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@
200200
"config.experimental.installGuide": "Experimental improvements for the git setup flow.",
201201
"config.repositoryScanIgnoredFolders": "List of folders that are ignored while scanning for Git repositories when `#git.autoRepositoryDetection#` is set to `true` or `subFolders`.",
202202
"config.repositoryScanMaxDepth": "Controls the depth used when scanning workspace folders for Git repositories when `#git.autoRepositoryDetection#` is set to `true` or `subFolders`. Can be set to `-1` for no limit.",
203+
"config.useIntegratedAskPass": "Controls whether GIT_ASKPASS should be overwritten to use the integrated version.",
203204
"submenu.explorer": "Git",
204205
"submenu.commit": "Commit",
205206
"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)