OSDN Git Service

Correct Handle case when patch file is not in repository path.
[tortoisegit/TortoiseGitJp.git] / src / TortoiseProc / Commands / ImportPatchCommand.cpp
index 6509e2e..f289e73 100644 (file)
@@ -25,6 +25,7 @@
 #include "Git.h"\r
 #include "DirFileEnum.h"\r
 #include "ShellUpdater.h"\r
+#include "AppUtils.h"\r
 \r
 bool ImportPatchCommand::Execute()\r
 {\r
@@ -33,6 +34,24 @@ bool ImportPatchCommand::Execute()
        CString cmd;\r
        CString output;\r
 \r
+       if(!this->orgCmdLinePath.IsAdminDir())\r
+       {\r
+               CString str=CAppUtils::ChooseRepository((CString*)&orgCmdLinePath.GetWinPathString());\r
+               CTGitPath path;\r
+               path.SetFromWin(str);\r
+               \r
+               if(!path.HasAdminDir())\r
+               {\r
+                       CString format;\r
+                       format.LoadString(IDS_ERR_NOT_REPOSITORY);\r
+                       CString err;\r
+                       err.Format(format,str);\r
+                       CMessageBox::Show(NULL,err,_T("TortoiseGit"),MB_OK|MB_ICONERROR);\r
+                       return FALSE;\r
+               }\r
+               g_Git.m_CurrentDir=str;\r
+       }\r
+\r
        for(int i=0;i<this->pathList.GetCount();i++)\r
        {\r
                if(!pathList[i].IsDirectory())\r