From c9147b36e776596710a6975e1571ff8153be8b4a Mon Sep 17 00:00:00 2001
From: Tobias Hunger <tobias.hunger@nokia.com>
Date: Fri, 1 Oct 2010 12:45:47 +0200
Subject: [PATCH] Git: Change mapping of repository to directory name

Change the mapping of repository name to checkout directory name.
This should now work better with windows.
---
 src/plugins/git/clonewizardpage.cpp | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/plugins/git/clonewizardpage.cpp b/src/plugins/git/clonewizardpage.cpp
index 3b321f96e4d..ea0b762421a 100644
--- a/src/plugins/git/clonewizardpage.cpp
+++ b/src/plugins/git/clonewizardpage.cpp
@@ -89,7 +89,8 @@ QString CloneWizardPage::directoryFromRepository(const QString &urlIn) const
      * 'user@host:qt/qt.git', 'http://host/qt/qt.git' 'local repo'
      * ------> 'qt' .  */
 
-    QString url = urlIn.trimmed();
+    QString url = urlIn.trimmed().replace(QChar('\\'), QChar('/'));
+
     const QChar slash = QLatin1Char('/');
     // remove host
     const int protocolDelimiterPos = url.indexOf(d->protocolDelimiter); // "://"
@@ -115,8 +116,9 @@ QString CloneWizardPage::directoryFromRepository(const QString &urlIn) const
     }
     // fix invalid characters
     const QChar dash = QLatin1Char('-');
-    url.replace(slash, dash);
-    url.replace(QLatin1Char('.'), dash);
+    url.replace(QRegExp(QLatin1String("[^0-9a-zA-Z_-]")), dash);
+    // trim leading dashes (they are annoying and get created when using local pathes)
+    url.replace(QRegExp(QLatin1String("^-+")), QString());
     return url;
 }
 
-- 
GitLab