OSDN Git Service

RebaseDlg: Fix Squash All Crash problem
authorFrank Li <lznuaa@gmail.com>
Fri, 27 Feb 2009 07:11:12 +0000 (15:11 +0800)
committerFrank Li <lznuaa@gmail.com>
Fri, 27 Feb 2009 07:11:12 +0000 (15:11 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/TortoiseProc/RebaseDlg.cpp

index 6c17618..479a526 100644 (file)
@@ -698,6 +698,11 @@ int CRebaseDlg::CheckNextCommitIsSquash()
        GitRev *curRev;\r
        do\r
        {\r
+               if(index<0)\r
+                       return -1;\r
+               if(index>= m_CommitList.GetItemCount())\r
+                       return -1;\r
+\r
                curRev=(GitRev*)m_CommitList.m_arShownList[index];\r
                \r
                if( curRev->m_Action&CTGitPath::LOGACTIONS_REBASE_SQUASH )\r
@@ -709,12 +714,7 @@ int CRebaseDlg::CheckNextCommitIsSquash()
                        else\r
                                index--;\r
                }else\r
-                       return -1;\r
-\r
-               if(index<0)\r
-                       return -1;\r
-               if(index>= m_CommitList.GetItemCount())\r
-                       return -1;\r
+                       return -1;              \r
 \r
        }while(curRev->m_Action&CTGitPath::LOGACTIONS_REBASE_SKIP);\r
        \r
@@ -1149,6 +1149,13 @@ void CRebaseDlg::OnBnClickedAbort()
        if(CMessageBox::Show(NULL,_T("Are you sure abort rebase"),_T("TortoiseGit"),MB_YESNO) != IDYES)\r
                return;\r
 \r
+       cmd.Format(_T("git checkout -f %s"),this->m_UpstreamCtrl.GetString());\r
+       if(g_Git.Run(cmd,&out,CP_UTF8))\r
+       {\r
+               AddLogString(out);\r
+               return ;\r
+       }\r
+\r
        cmd.Format(_T("git.exe reset --hard  %s"),this->m_OrigUpstreamHash.Left(40));\r
        if(g_Git.Run(cmd,&out,CP_UTF8))\r
        {\r
@@ -1163,5 +1170,11 @@ void CRebaseDlg::OnBnClickedAbort()
                return ;\r
        }\r
        \r
+       cmd.Format(_T("git.exe reset --hard  %s"),this->m_OrigBranchHash.Left(40));\r
+       if(g_Git.Run(cmd,&out,CP_UTF8))\r
+       {\r
+               AddLogString(out);\r
+               return ;\r
+       }\r
        __super::OnCancel();\r
 }\r