Allow disabling integrated askpass (#115455)

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
This commit is contained in:
Backfighter 2022-03-21 16:31:04 +01:00 committed by GitHub
parent dde1d2736e
commit b8a5e18171
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 2 deletions

View file

@ -2189,6 +2189,11 @@
"default": false,
"description": "%config.useCommitInputAsStashMessage%"
},
"git.useIntegratedAskPass": {
"type": "boolean",
"default": true,
"description": "%config.useIntegratedAskPass%"
},
"git.githubAuthentication": {
"deprecationMessage": "This setting is now deprecated, please use `github.gitAuthentication` instead."
},

View file

@ -200,6 +200,7 @@
"config.experimental.installGuide": "Experimental improvements for the git setup flow.",
"config.repositoryScanIgnoredFolders": "List of folders that are ignored while scanning for Git repositories when `#git.autoRepositoryDetection#` is set to `true` or `subFolders`.",
"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.",
"config.useIntegratedAskPass": "Controls whether GIT_ASKPASS should be overwritten to use the integrated version.",
"submenu.explorer": "Git",
"submenu.commit": "Commit",
"submenu.commit.amend": "Amend",

View file

@ -79,13 +79,19 @@ export class Askpass implements IIPCHandler {
};
}
return {
let env: { [key: string]: string; } = {
...this.ipc.getEnv(),
GIT_ASKPASS: path.join(__dirname, 'askpass.sh'),
VSCODE_GIT_ASKPASS_NODE: process.execPath,
VSCODE_GIT_ASKPASS_EXTRA_ARGS: (process.versions['electron'] && process.versions['microsoft-build']) ? '--ms-enable-electron-run-as-node' : '',
VSCODE_GIT_ASKPASS_MAIN: path.join(__dirname, 'askpass-main.js')
};
const config = workspace.getConfiguration('git');
if (config.get<boolean>('useIntegratedAskPass')) {
env.GIT_ASKPASS = path.join(__dirname, 'askpass.sh');
}
return env;
}
registerCredentialsProvider(provider: CredentialsProvider): Disposable {