Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git: fix includeIf on Windows by uppercasing drive letter (#40354) #50376

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions extensions/git/src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,14 @@ function getGitErrorCode(stderr: string): string | undefined {
return void 0;
}

function sanitizeCwd(cwd: string): string {
// Make the drive letter uppercase on Windows for includeIf (#40354)
if (os.platform() === 'win32' && cwd && cwd[1] === ':') {
return cwd[0].toUpperCase() + cwd.substr(1);
}
return cwd;
}

export class Git {

readonly path: string;
Expand Down Expand Up @@ -420,11 +428,13 @@ export class Git {
}

async exec(cwd: string, args: string[], options: SpawnOptions = {}): Promise<IExecutionResult<string>> {
cwd = sanitizeCwd(cwd);
options = assign({ cwd }, options || {});
return await this._exec(args, options);
}

stream(cwd: string, args: string[], options: SpawnOptions = {}): cp.ChildProcess {
cwd = sanitizeCwd(cwd);
options = assign({ cwd }, options || {});
return this.spawn(args, options);
}
Expand Down