OSDN Git Service

Add Shell Notification at add, cleanup and remove and rename, CommitDlg.cpp
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / Commands / RemoveCommand.cpp
index 8b1c882..3e07246 100644 (file)
@@ -116,5 +116,39 @@ bool RemoveCommand::Execute()
        if (bRet)\r
                CShellUpdater::Instance().AddPathsForUpdate(pathList);\r
 #endif\r
+       int key=CMessageBox::Show(hwndExplorer, _T("File will removed from version control\r\n Do you want to keep local copy"), _T("TortoiseGit"), MB_ICONINFORMATION|MB_YESNOCANCEL);\r
+       if(key == IDCANCEL)\r
+               return FALSE;\r
+\r
+       CString format;\r
+       if(key == IDNO)\r
+               format=_T("git.exe rm -r -f \"%s\"");\r
+\r
+       if(key == IDYES)\r
+               format= _T("git.exe update-index --force-remove -- \"%s\"");\r
+\r
+       CString output;\r
+       CString cmd;\r
+       int nPath;\r
+       for(nPath = 0; nPath < pathList.GetCount(); nPath++)\r
+       {\r
+\r
+               cmd.Format(format,pathList[nPath].GetGitPathString());\r
+               if(g_Git.Run(cmd,&output,CP_OEMCP))\r
+               {\r
+                       key=CMessageBox::Show(hwndExplorer, output, _T("TortoiseGit"), MB_ICONERROR|MB_OKCANCEL);\r
+                       if(key == IDCANCEL)\r
+                               return FALSE;\r
+\r
+               }\r
+       }\r
+\r
+       output.Format(_T("%d files removed"),nPath);\r
+       \r
+       CShellUpdater::Instance().AddPathsForUpdate(pathList);\r
+\r
+       CMessageBox::Show(hwndExplorer, output, _T("TortoiseGit"), MB_ICONINFORMATION|MB_OK);\r
+\r
+       CShellUpdater::Instance().Flush();\r
        return bRet;\r
 }\r