OSDN Git Service

restored the accidently removed quotes on igit command line
[tortoisegit/TortoiseGitJp.git] / src / Git / Git.cpp
index a209a53..4e5e951 100644 (file)
@@ -358,6 +358,17 @@ CString CGit::GetSymbolicRef(const wchar_t* symbolicRefName, bool bStripRefsHead
        return refName;\r
 }\r
 \r
+CString CGit::GetFullRefName(CString shortRefName)\r
+{\r
+       CString refName;\r
+       CString cmd;\r
+       cmd.Format(L"git rev-parse --symbolic-full-name %s", shortRefName);\r
+       if(Run(cmd, &refName, CP_UTF8) != 0)\r
+               return CString();//Error\r
+       int iStart = 0;\r
+       return refName.Tokenize(L"\n", iStart);\r
+}\r
+\r
 CString CGit::StripRefName(CString refName)\r
 {\r
        if(wcsncmp(refName, L"refs/heads/", 11) == 0)\r
@@ -1052,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
@@ -1106,7 +1134,8 @@ int CGit::Revert(CTGitPath &path,bool keep)
        CString cmd, out;\r
        if(path.m_Action & CTGitPath::LOGACTIONS_ADDED)\r
        {       //To init git repository, there are not HEAD, so we can use git reset command\r
-               cmd.Format(_T("git.exe rm --cache -- \"%s\""),path.GetGitPathString());\r
+               cmd.Format(_T("git.exe rm --cached \"%s\""),path.GetGitPathString());\r
+\r
                if(g_Git.Run(cmd,&out,CP_ACP))\r
                        return -1;\r
        }\r