OSDN Git Service

fixed backslash issues with igit commandline (resulted in overlays not working in...
authorMyagi <snowcoder@gmail.com>
Mon, 13 Jul 2009 23:07:45 +0000 (01:07 +0200)
committerFrank Li <lznuaa@gmail.com>
Tue, 14 Jul 2009 01:13:03 +0000 (09:13 +0800)
src/Git/Git.cpp
src/Git/GitAdminDir.cpp
src/Git/GitFolderStatus.cpp

index 864684b..a1cae65 100644 (file)
@@ -1063,10 +1063,27 @@ BOOL CGit::EnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsig
                sMode = _T("-");\r
        }\r
 \r
+       // NOTE: there seems to be some issue with msys based app receiving backslash on commandline, at least\r
+       // if followed by " like for example 'igit "C:\"', the commandline igit receives is 'igit.exe C:" status' with\r
+       // the 'C:" status' part as a single arg, Maybe it uses unix style processing. In order to avoid this just\r
+       // use forward slashes for supplied project and sub paths\r
+\r
+       CString sProjectPath = pszProjectPath;\r
+       sProjectPath.Replace(_T('\\'), _T('/'));\r
+\r
        if (pszSubPath)\r
-               cmd.Format(_T("igit.exe \"%s\" status %s \"%s\""), pszProjectPath, sMode, pszSubPath);\r
+       {\r
+               CString sSubPath = pszSubPath;\r
+               sSubPath.Replace(_T('\\'), _T('/'));\r
+\r
+               cmd.Format(_T("igit.exe \"%s\" status %s \"%s\""), sProjectPath, sMode, sSubPath);\r
+       }\r
        else\r
-               cmd.Format(_T("igit.exe \"%s\" status %s"), pszProjectPath, sMode);\r
+       {\r
+               cmd.Format(_T("igit.exe %s status %s"), sProjectPath, sMode);\r
+       }\r
+\r
+       //OutputDebugStringA("---");OutputDebugStringW(cmd);OutputDebugStringA("\r\n");\r
 \r
        W_GitCall.SetCmd(cmd);\r
        // NOTE: should igit get added as a part of msysgit then use below line instead of the above one\r
index 44556ea..d7b882f 100644 (file)
@@ -146,7 +146,12 @@ bool GitAdminDir::HasAdminDir(const CString& path, bool bDir,CString *ProjectTop
                if(PathFileExists(sDirName + _T("\\.git")))\r
                {\r
                        if(ProjectTopDir)\r
+                       {\r
                                *ProjectTopDir=sDirName;\r
+                               // Make sure to add the trailing slash to root paths such as 'C:'\r
+                               if (sDirName.GetLength() == 2 && sDirName[1] == ':')\r
+                                       (*ProjectTopDir) += _T("\\");\r
+                       }\r
                        return true;\r
                }\r
                sDirName = sDirName.Left(sDirName.ReverseFind('\\'));\r
index b9a4342..fd680b0 100644 (file)
@@ -262,6 +262,7 @@ const FileStatusCacheEntry * GitFolderStatus::BuildCache(const CTGitPath& filepa
 \r
 //if (lpszSubPath) MessageBoxA(NULL, lpszSubPath, "BuildCache", MB_OK);\r
 //MessageBoxA(NULL, CStringA(sProjectRoot), sSubPath, MB_OK);\r
+//OutputDebugStringA("---");OutputDebugStringW(sProjectRoot);OutputDebugStringA(" = ");OutputDebugStringW(filepath.GetWinPathString());OutputDebugStringA(" - ");OutputDebugStringW(sSubPath);OutputDebugStringA("\r\n");\r
                        err = !wgEnumFiles(sProjectRoot, lpszSubPath, WGEFF_NoRecurse|WGEFF_FullPath|WGEFF_DirStatusAll, &fillstatusmap, this);\r
 \r
                        /*err = svn_client_status4 (&youngest,\r