OSDN Git Service

Fixed issue #109: clone on bare local repository fails
authorFrank Li <lznuaa@gmail.com>
Thu, 9 Jul 2009 15:05:16 +0000 (23:05 +0800)
committerFrank Li <lznuaa@gmail.com>
Thu, 9 Jul 2009 15:05:16 +0000 (23:05 +0800)
Clear trail slash \ or/

Signed-off-by: Frank Li <lznuaa@gmail.com>
src/TortoiseProc/AppUtils.cpp
src/TortoiseProc/AppUtils.h
src/TortoiseProc/Commands/CloneCommand.cpp

index 0abb67d..9f2b6c4 100644 (file)
@@ -2116,3 +2116,16 @@ bool CAppUtils::CreateMultipleDirectory(CString& szPath)
 \r
     return bSuccess;\r
 }\r
+\r
+void CAppUtils::RemoveTrailSlash(CString &path)\r
+{\r
+       if(path.IsEmpty())\r
+               return ;\r
+       \r
+       while(path[path.GetLength()-1] == _T('\\') || path[path.GetLength()-1] == _T('/' ) )\r
+       {\r
+               path=path.Left(path.GetLength()-1);\r
+               if(path.IsEmpty())\r
+                       return;\r
+       }\r
+}
\ No newline at end of file
index e2d98f4..41f79b2 100644 (file)
@@ -204,6 +204,8 @@ public:
 \r
        static bool CreateMultipleDirectory(CString &dir);\r
 \r
+       static void RemoveTrailSlash(CString &path);\r
+\r
 private:\r
        static CString PickDiffTool(const CTGitPath& file1, const CTGitPath& file2);\r
        static bool GetMimeType(const CTGitPath& file, CString& mimetype);\r
index 14b123a..890deb0 100644 (file)
@@ -38,8 +38,13 @@ bool CloneCommand::Execute()
                {\r
                        CAppUtils::LaunchPAgent(&dlg.m_strPuttyKeyFile);\r
                }\r
+       \r
+               CAppUtils::RemoveTrailSlash(dlg.m_Directory);\r
+               CAppUtils::RemoveTrailSlash(dlg.m_URL);\r
+\r
                CString dir=dlg.m_Directory;\r
                CString url=dlg.m_URL;\r
+\r
                // is this a windows format UNC path, ie starts with \\ \r
                if (url.Find(_T("\\\\")) == 0)\r
                {\r