Merge pull request #82038 from jeanp413/fix-81158

Fix git repository not detected if root folder ends in [space]
This commit is contained in:
João Moreno 2019-10-21 16:01:18 +02:00 committed by GitHub
commit ad9bce8978
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -401,7 +401,8 @@ export class Git {
async getRepositoryRoot(repositoryPath: string): Promise<string> {
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<string> {