Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/microsoft/vscode.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/git/src/git.ts')
-rw-r--r--extensions/git/src/git.ts16
1 files changed, 12 insertions, 4 deletions
diff --git a/extensions/git/src/git.ts b/extensions/git/src/git.ts
index d6b9ef01b70..0ccf22301c4 100644
--- a/extensions/git/src/git.ts
+++ b/extensions/git/src/git.ts
@@ -475,8 +475,9 @@ export class Git {
const repoPath = path.normalize(result.stdout.trimLeft().replace(/[\r\n]+$/, ''));
if (isWindows) {
- // On Git 2.25+ if you call `rev-parse --show-toplevel` on a mapped drive, instead of getting the mapped drive path back, you get the UNC path for the mapped drive.
- // So we will try to normalize it back to the mapped drive path, if possible
+ // On Git 2.25+ if you call `rev-parse --show-toplevel` on a mapped drive, instead of getting the mapped
+ // drive path back, you get the UNC path for the mapped drive. So we will try to normalize it back to the
+ // mapped drive path, if possible
const repoUri = Uri.file(repoPath);
const pathUri = Uri.file(repositoryPath);
if (repoUri.authority.length !== 0 && pathUri.authority.length === 0) {
@@ -504,6 +505,13 @@ export class Git {
return path.normalize(pathUri.fsPath);
}
+
+ // On Windows, there are cases in which the normalized path for a mapped folder contains a trailing `\`
+ // character (ex: \\server\folder\) due to the implementation of `path.normalize()`. This behaviour is
+ // by design as documented in https://github.com/nodejs/node/issues/1765.
+ if (repoUri.authority.length !== 0) {
+ return repoPath.replace(/\\$/, '');
+ }
}
return repoPath;
@@ -1785,12 +1793,12 @@ export class Repository {
} catch (err) {
if (/^error: failed to push some refs to\b/m.test(err.stderr || '')) {
err.gitErrorCode = GitErrorCodes.PushRejected;
+ } else if (/Permission.*denied/.test(err.stderr || '')) {
+ err.gitErrorCode = GitErrorCodes.PermissionDenied;
} else if (/Could not read from remote repository/.test(err.stderr || '')) {
err.gitErrorCode = GitErrorCodes.RemoteConnectionError;
} else if (/^fatal: The current branch .* has no upstream branch/.test(err.stderr || '')) {
err.gitErrorCode = GitErrorCodes.NoUpstreamBranch;
- } else if (/Permission.*denied/.test(err.stderr || '')) {
- err.gitErrorCode = GitErrorCodes.PermissionDenied;
}
throw err;