Git: Fix remote detection for local remotes starting with "file://"

Task-number: QTCREATORBUG-20618
Change-Id: I21cddf88b64fa7a6acdc92228142976284ef8942
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
This commit is contained in:
Andre Hartmann
2018-07-29 21:51:43 +02:00
committed by André Hartmann
parent 11ffd3d702
commit 495356ce9d

View File

@@ -3371,10 +3371,10 @@ GitRemote::GitRemote(const QString &url)
// Check for local remotes (refer to the root or relative path) // Check for local remotes (refer to the root or relative path)
// On Windows, local paths typically starts with <drive>: // On Windows, local paths typically starts with <drive>:
if (url.startsWith('/') || url.startsWith('.') if (url.startsWith("file://") || url.startsWith('/') || url.startsWith('.')
|| (HostOsInfo::isWindowsHost() && url[1] == ':')) { || (HostOsInfo::isWindowsHost() && url[1] == ':')) {
protocol = "file"; protocol = "file";
path = QDir::fromNativeSeparators(url); path = QDir::fromNativeSeparators(url.startsWith("file://") ? url.mid(7) : url);
isValid = QDir(path).exists() || QDir(path + ".git").exists(); isValid = QDir(path).exists() || QDir(path + ".git").exists();
return; return;
} }