diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts index 5d47228c455222d665ae226318940819f5d26f49..cb53022792ad8b66f8fac4bc32a8b06f69db6b16 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 {