diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index 5d47228c455..cb53022792a 100644 --- a/extensions/git/src/git.ts +++ b/extensions/git/src/git.ts @@ -370,7 +370,8 @@ export class Git { async getRepositoryRoot(repositoryPath: string): Promise { const result = await this.exec(repositoryPath, ['rev-parse', '--show-toplevel']); - return path.normalize(result.stdout.trim()); + // Keep trailing spaces which are part of the directory name + return path.normalize(result.stdout.trimLeft().replace(/(\r\n|\r|\n)+$/, '')); } async getRepositoryDotGit(repositoryPath: string): Promise {