OSDN Git Service

FormatPatch Finished
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / Commands / RenameCommand.cpp
index 8f37cf4..2e6fd36 100644 (file)
 #include "RenameCommand.h"\r
 \r
 #include "MessageBox.h"\r
-#include "SVNProgressDlg.h"\r
-#include "ProgressDlg.h"\r
+//#include "SVNProgressDlg.h"\r
+//#include "ProgressDlg.h"\r
 #include "RenameDlg.h"\r
 #include "InputLogDlg.h"\r
-#include "SVN.h"\r
+#include "Git.h"\r
 #include "DirFileEnum.h"\r
 #include "ShellUpdater.h"\r
 \r
@@ -32,8 +32,8 @@ bool RenameCommand::Execute()
 {\r
        bool bRet = false;\r
        CString filename = cmdLinePath.GetFileOrDirectoryName();\r
-       CString basePath = cmdLinePath.GetContainingDirectory().GetWinPathString();\r
-       ::SetCurrentDirectory(basePath);\r
+       CString basePath = cmdLinePath.GetContainingDirectory().GetGitPathString();\r
+       //::SetCurrentDirectory(basePath);\r
 \r
        // show the rename dialog until the user either cancels or enters a new\r
        // name (one that's different to the original name\r
@@ -47,6 +47,21 @@ bool RenameCommand::Execute()
                sNewName = dlg.m_name;\r
        } while(PathIsRelative(sNewName) && !PathIsURL(sNewName) && (sNewName.IsEmpty() || (sNewName.Compare(filename)==0)));\r
 \r
+       if(!basePath.IsEmpty())\r
+               sNewName=basePath+"/"+sNewName;\r
+\r
+       CString cmd;\r
+       CString output;\r
+       cmd.Format(_T("git.cmd mv \"%s\" \"%s\""),\r
+                                       cmdLinePath.GetGitPathString(),\r
+                                       sNewName);\r
+                                                                       \r
+       if(g_Git.Run(cmd,&output))\r
+       {\r
+               CMessageBox::Show(hwndExplorer, output, _T("TortoiseGit"), MB_OK);\r
+       }\r
+\r
+#if 0\r
        TRACE(_T("rename file %s to %s\n"), (LPCTSTR)cmdLinePath.GetWinPathString(), (LPCTSTR)sNewName);\r
        CTSVNPath destinationPath(basePath);\r
        if (PathIsRelative(sNewName) && !PathIsURL(sNewName))\r
@@ -232,5 +247,6 @@ bool RenameCommand::Execute()
                        }\r
                }\r
        }\r
+#endif\r
        return bRet;\r
 }\r