Vscode: Support multiple values for the git.path setting

Created on 28 Nov 2019  路  7Comments  路  Source: microsoft/vscode

I use VSCode in three different places; my home computer, my work computer, and as a portable version I carry on a drive when I need to use a machine that doesn't have it.

I use an extension to keep my settings synced up between editors, and the only issue I've encountered so far is that the git path doesn't match between any of them. On my home machine I have it installed to C of course, work likes to be funny and install it on A, and for the one on my drive I have a relative path set so that no matter what letter my drive gets, that VSCode can always find git.

I already attempted to use an array myself just to see if it'd work:
"git.path": ["C:\\Program Files\\Git\\bin\\git.exe", "A:\\Git\\bin\\git.exe", "..\\..\\Git\\bin\\git.exe"],

But VSCode reads it as one entire value.

What I'd like is for it to recognize it as an array and then try each path in order until it finds Git or runs out of paths.

feature-request git good first issue help wanted insiders-released on-release-notes verification-needed verified

Most helpful comment

This is a good feature request, please feel free to submit a PR.

All 7 comments

It is better to create an issue in https://github.com/shanalikhan/code-settings-sync extension repo with requesting the settings ignore feature.

Hy @CMDMC12

You can ignore certain settings in settings.json or keybindings.json by using the @sync-ignore pragma.

// settings.json

{
// @sync-ignore
"window.zoomLevel": "1", /* won't upload to gist */
}

Read More >>

This is a good feature request, please feel free to submit a PR.

Hy @CMDMC12

You can ignore certain settings in settings.json or keybindings.json by using the @sync-ignore pragma.

// settings.json

{
// @sync-ignore
"window.zoomLevel": "1", /* won't upload to gist */
}

Read More >>

Ah, thanks. I must have just seen the section title and completely glossed over it when I was reading through the docs.

I could help out with this feature-request, if you would like.

At a glance, it looks like it would require a modification to the "createModel()" function in the "vscode/extensions/git/src/git.ts" file (line 34).

We could get the "pathHint" as a string array and then possibly modify the logic inside of the "findGit()" function, or, if possible, iterate through the "pathHint" array until a valid "info.path" value is returned.

EDIT: Sorry, didn't realize a PR was already submitted...

This is a good feature request, please feel free to submit a PR.

Raised PR!

Verification

The git.path setting now accepts a list of values. The git extension must go through them one by one until it finds a usable git executable.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

chrisdias picture chrisdias  路  3Comments

vsccarl picture vsccarl  路  3Comments

DovydasNavickas picture DovydasNavickas  路  3Comments

lukehoban picture lukehoban  路  3Comments

borekb picture borekb  路  3Comments