1
1
mirror of https://github.com/kahole/edamagit.git synced 2024-09-11 07:15:31 +03:00

fixed windows git folder issue (#243)

This commit is contained in:
rhoeberg 2023-04-01 12:11:46 +02:00
parent a942a8a46e
commit 26d3a22c9a
3 changed files with 11 additions and 3 deletions

View File

@ -423,6 +423,11 @@
"type": "boolean",
"default": false,
"description": "Enable automatic confirm for switch menu after enabling a switch (e.g. --force)"
},
"magit.win-git-path": {
"type": "string",
"default": "",
"description": "Specify path to windows git installation (parent folder to the 'Git' folder). Necesarry if git is installed in a custom path on windows"
}
}
},
@ -717,7 +722,7 @@
"ts-loader": "^9.4.2",
"typescript": "^4.9.5",
"vscode-test": "^1.4.1",
"webpack": "^5.75.0",
"webpack": "^5.77.0",
"webpack-cli": "^5.0.1"
},
"dependencies": {

View File

@ -48,7 +48,7 @@ export const processLog: MagitProcessLogEntry[] = [];
export let gitApi: API;
export let logPath: string;
export let magitConfig: { displayBufferSameColumn?: boolean, forgeEnabled?: boolean, hiddenStatusSections: Set<string>, quickSwitchEnabled?: boolean };
export let magitConfig: { displayBufferSameColumn?: boolean, forgeEnabled?: boolean, hiddenStatusSections: Set<string>, quickSwitchEnabled?: boolean, winGitPath?: string };
function loadConfig() {
let workspaceConfig = workspace.getConfiguration('magit');
@ -57,7 +57,8 @@ function loadConfig() {
displayBufferSameColumn: workspaceConfig.get('display-buffer-function') === 'same-column',
forgeEnabled: workspaceConfig.get('forge-enabled'),
hiddenStatusSections: readHiddenStatusSections(workspaceConfig.get('hide-status-sections')),
quickSwitchEnabled: workspaceConfig.get('quick-switch-enabled')
quickSwitchEnabled: workspaceConfig.get('quick-switch-enabled'),
winGitPath: workspaceConfig.get('win-git-path')
};
let configCodePath: string | undefined = workspaceConfig.get('code-path');

View File

@ -2,6 +2,7 @@ import * as cp from 'child_process';
import { cpErrorHandler } from './command';
import path = require('path');
import * as which from 'which';
import { magitConfig } from '../../extension';
export interface IGit {
path: string;
@ -85,6 +86,7 @@ function findGitWin32InPath(onValidate: (path: string) => boolean): Promise<IGit
function findGitWin32(onValidate: (path: string) => boolean): Promise<IGit> {
return findSystemGitWin32(process.env['ProgramW6432'] as string, onValidate)
.then(undefined, () => findSystemGitWin32(magitConfig.winGitPath || '', onValidate))
.then(undefined, () => findSystemGitWin32(process.env['ProgramFiles(x86)'] as string, onValidate))
.then(undefined, () => findSystemGitWin32(process.env['ProgramFiles'] as string, onValidate))
.then(undefined, () => findSystemGitWin32(path.join(process.env['LocalAppData'] as string, 'Programs'), onValidate))