OSDN Git Service

Merge myapi_overlay.
authorFrank Li <lznuaa@gmail.com>
Mon, 2 Feb 2009 15:37:09 +0000 (23:37 +0800)
committerFrank Li <lznuaa@gmail.com>
Mon, 2 Feb 2009 15:37:09 +0000 (23:37 +0800)
Basic implment iconOverlay

Signed-off-by: Frank Li <lznuaa@gmail.com>
1  2 
src/Git/Git.cpp
src/Git/TGitPath.cpp
src/Git/TGitPath.h
src/TortoiseGitBlame/TortoiseGitBlame.vcproj
src/TortoiseShell/ShellCache.h

diff --cc src/Git/Git.cpp
@@@ -529,61 -625,61 +631,71 @@@ BOOL CGit::CheckMsysGitDir(
        TCHAR *oldpath,*home;\r
        size_t size;\r
  \r
-       _tdupenv_s(&home,&size,_T("HOME")); \r
-       \r
-       if(home == NULL)\r
-       {               \r
+       // set HOME if not set already\r
+       _tgetenv_s(&size, NULL, 0, _T("HOME"));\r
+       if (!size)\r
+       {\r
                _tdupenv_s(&home,&size,_T("USERPROFILE")); \r
                _tputenv_s(_T("HOME"),home);\r
+               free(home);\r
        }\r
-       free(home);\r
-       \r
-       //set path\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
+       // search PATH if git/bin directory is alredy present\r
+       if ( FindGitPath() )\r
        {\r
-               // not already there, see if we have to take out one we added last time\r
-               if ( ms_LastMsysGitDir != _T("") )\r
+               bInitialized = TRUE;\r
+               return TRUE;\r
+       }\r
\r
+       // add git/bin path to PATH\r
\r
+       CRegString msysdir=CRegString(REG_MSYSGIT_PATH,_T(""),FALSE,HKEY_LOCAL_MACHINE);\r
+       CString str=msysdir;\r
+       if(str.IsEmpty())\r
+       {\r
+               CRegString msysinstalldir=CRegString(REG_MSYSGIT_INSTALL,_T(""),FALSE,HKEY_LOCAL_MACHINE);\r
+               str=msysinstalldir;\r
+               if ( !str.IsEmpty() )\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
+                       str += (str[str.GetLength()-1] != '\\') ? "\\bin" : "bin";\r
+                       msysdir=str;\r
+                       msysdir.write();\r
+               }\r
+               else\r
+               {\r
+                       return false;\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
+       //CGit::m_MsysGitPath=str;\r
\r
+       //set path\r
\r
+       _tdupenv_s(&oldpath,&size,_T("PATH")); \r
\r
+       CString path;\r
+       path.Format(_T("%s;%s"),oldpath,str);\r
\r
+       _tputenv_s(_T("PATH"),path);\r
\r
        free(oldpath);\r
  \r
-       //setup ssh client\r
 -      if( !FindGitPath() )\r
++\r
++     //setup ssh client\r
 +      CRegString sshclient=CRegString(_T("Software\\TortoiseGit\\SSH"));\r
 +      CString ssh=sshclient;\r
- //    ssh.Format(_T("\"%s\""),(CString)sshclient);\r
 +\r
 +      if(!ssh.IsEmpty())\r
 +      {\r
 +              _tputenv_s(_T("GIT_SSH"),ssh);\r
 +      }\r
 +\r
-       CString cmd,out;\r
-       cmd=_T("git.exe --version");\r
-       if(g_Git.Run(cmd,&out,CP_UTF8))\r
++    if( !FindGitPath() )\r
        {\r
                return false;\r
        }\r
        else\r
+       {\r
+               bInitialized = TRUE;\r
                return true;\r
\r
- }
+       }\r
 -}
++}\r
Simple merge
Simple merge
Simple merge