return FALSE;\r
}\r
\r
- TCHAR *env = (TCHAR*)alloca(size);\r
+ TCHAR *env = (TCHAR*)alloca(size * sizeof(TCHAR));\r
_tgetenv_s(&size, env, size, _T("PATH"));\r
\r
TCHAR buf[_MAX_PATH];\r
\r
- const LPCTSTR filename = _T("git.exe");\r
- const int filelen = _tcslen(filename);\r
-\r
// search in all paths defined in PATH\r
while ((env = nextpath(env, buf, _MAX_PATH-1)) && *buf)\r
{\r
TCHAR *pfin = buf + _tcslen(buf)-1;\r
\r
// ensure trailing slash\r
- if (*pfin != '/' && *pfin != '\\')\r
- _tccpy(pfin+1, _T("\\"));\r
+ if (*pfin != _T('/') && *pfin != _T('\\'))\r
+ _tcscpy(++pfin, _T("\\"));\r
\r
const int len = _tcslen(buf);\r
\r
- if ((len + filelen) < _MAX_PATH)\r
- _tccpy(buf+len, filename);\r
+ if ((len + 7) < _MAX_PATH)\r
+ _tcscpy(pfin+1, _T("git.exe"));\r
else\r
break;\r
\r
{\r
CRegString msysinstalldir=CRegString(REG_MSYSGIT_INSTALL,_T(""),FALSE,HKEY_LOCAL_MACHINE);\r
str=msysinstalldir;\r
- // check it has a trailing blank\r
- if (str.Right(1) != _T("\\"))\r
- {\r
- str += _T("\\");\r
- }\r
- str+=_T("bin");\r
- msysdir=str;\r
- msysdir.write();\r
-\r
+ if ( !str.IsEmpty() )\r
+ {\r
+ str += (str[str.GetLength()-1] != '\\') ? "\\bin" : "bin";\r
+ msysdir=str;\r
+ msysdir.write();\r
+ }\r
+ else\r
+ {\r
+ return false;\r
+ }\r
}\r
//CGit::m_MsysGitPath=str;\r
\r
_tdupenv_s(&oldpath,&size,_T("PATH")); \r
\r
CString path;\r
- CString unterminated_path = str; // path to msysgit without semicolon\r
- CString oldpath_s = oldpath;\r
- path.Format(_T("%s;"),str);\r
- // check msysgit not already in path\r
- if ( oldpath_s.Find( path ) < 0 && oldpath_s.Right( unterminated_path.GetLength() ) != unterminated_path )\r
- {\r
- // not already there, see if we have to take out one we added last time\r
- if ( ms_LastMsysGitDir != _T("") )\r
- {\r
- // we have added one so take it out\r
- int index = oldpath_s.Find( ms_LastMsysGitDir );\r
- if ( index >= 0 )\r
- {\r
- oldpath_s = oldpath_s.Left( index ) + \r
- oldpath_s.Right( oldpath_s.GetLength() - (index+ms_LastMsysGitDir.GetLength()) );\r
- }\r
- }\r
- // save the new msysdir path that we are about to add\r
- ms_LastMsysGitDir = path;\r
- // add the new one on the front of the existing path\r
- path+=oldpath_s;\r
- _tputenv_s(_T("PATH"),path);\r
- }\r
+ path.Format(_T("%s;%s"),oldpath,str);\r
+\r
+ _tputenv_s(_T("PATH"),path);\r
+\r
free(oldpath);\r
\r
if( !FindGitPath() )\r
}\r
} // for (int i = 0; i < count; ++i)\r
ItemIDList child (GetPIDLItem (cida, 0), &parent);\r
-// if (g_ShellCache.HasGitAdminDir(child.toString().c_str(), FALSE))\r
+// ? was this disabled because the /wc option does not work safely with Git? or because the code below didn't compile before?\r
+// if (g_ShellCache.HasSVNAdminDir(child.toString().c_str(), FALSE))\r
// itemStates |= ITEMIS_INVERSIONEDFOLDER;\r
GlobalUnlock(medium.hGlobal);\r
\r
// if the item is a versioned folder, check if there's a patch file\r
// in the clipboard to be used in "Apply Patch"\r
- UINT cFormatDiff = RegisterClipboardFormat(_T("Tgit_UNIFIEDDIFF"));\r
+ UINT cFormatDiff = RegisterClipboardFormat(_T("TGIT_UNIFIEDDIFF"));\r
if (cFormatDiff)\r
{\r
if (IsClipboardFormatAvailable(cFormatDiff)) \r
TCHAR * path = new TCHAR[pathlength+1];\r
TCHAR * tempFile = new TCHAR[pathlength + 100];\r
GetTempPath (pathlength+1, path);\r
- GetTempFileName (path, _T("svn"), 0, tempFile);\r
+ GetTempFileName (path, _T("git"), 0, tempFile);\r
tempfile = stdstring(tempFile);\r
\r
HANDLE file = ::CreateFile (tempFile,\r
TCHAR * path = new TCHAR[pathlength+1];\r
TCHAR * tempFile = new TCHAR[pathlength + 100];\r
GetTempPath (pathlength+1, path);\r
- GetTempFileName (path, _T("svn"), 0, tempFile);\r
+ GetTempFileName (path, _T("git"), 0, tempFile);\r
stdstring retFilePath = stdstring(tempFile);\r
\r
HANDLE file = ::CreateFile (tempFile,\r
{\r
// if there's a patch file in the clipboard, we save it\r
// to a temporary file and tell TortoiseMerge to use that one\r
- UINT cFormat = RegisterClipboardFormat(_T("Tgit_UNIFIEDDIFF"));\r
+ UINT cFormat = RegisterClipboardFormat(_T("TGIT_UNIFIEDDIFF"));\r
if ((cFormat)&&(OpenClipboard(NULL)))\r
{ \r
HGLOBAL hglb = GetClipboardData(cFormat); \r
TCHAR * path = new TCHAR[len+1];\r
TCHAR * tempF = new TCHAR[len+100];\r
GetTempPath (len+1, path);\r
- GetTempFileName (path, TEXT("svn"), 0, tempF);\r
+ GetTempFileName (path, TEXT("git"), 0, tempF);\r
std::wstring sTempFile = std::wstring(tempF);\r
delete [] path;\r
delete [] tempF;\r