OSDN Git Service

Fix Issue 6 Add does not work.
authorFrank Li <lznuaa@gmail.com>
Wed, 4 Feb 2009 16:18:59 +0000 (00:18 +0800)
committerFrank Li <lznuaa@gmail.com>
Wed, 4 Feb 2009 16:18:59 +0000 (00:18 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/Git/GitStatusListCtrl.cpp
src/TortoiseProc/AddDlg.cpp
src/TortoiseProc/Commands/AddCommand.cpp

index 7d4c8d6..6cb5570 100644 (file)
@@ -1085,8 +1085,12 @@ void CGitStatusListCtrl::Show(DWORD dwShow, DWORD dwCheck /*=0*/, bool bShowFold
        }\r
        for(int i=0;i<this->m_arStatusArray.size();i++)\r
        {\r
+               //set default checkbox status\r
+               if(((CTGitPath*)m_arStatusArray[i])->m_Action & dwCheck)\r
+                       ((CTGitPath*)m_arStatusArray[i])->m_Checked=true;\r
+\r
                if(((CTGitPath*)m_arStatusArray[i])->m_Action & dwShow)\r
-                               AddEntry((CTGitPath*)m_arStatusArray[i],langID,i);\r
+                       AddEntry((CTGitPath*)m_arStatusArray[i],langID,i);\r
        }\r
        \r
        int maxcol = ((CHeaderCtrl*)(GetDlgItem(0)))->GetItemCount()-1;\r
@@ -1730,8 +1734,8 @@ void CGitStatusListCtrl::AddEntry(FileEntry * entry, WORD langID, int listIndex)
 #endif\r
 bool CGitStatusListCtrl::SetItemGroup(int item, int groupindex)\r
 {\r
-       if ((m_dwContextMenus & SVNSLC_POPCHANGELISTS) == NULL)\r
-               return false;\r
+//     if ((m_dwContextMenus & SVNSLC_POPCHANGELISTS) == NULL)\r
+//             return false;\r
        if (groupindex < 0)\r
                return false;\r
        LVITEM i = {0};\r
@@ -4421,20 +4425,20 @@ void CGitStatusListCtrl::SetCheckOnAllDescendentsOf(const FileEntry* parentEntry
 \r
 void CGitStatusListCtrl::WriteCheckedNamesToPathList(CTGitPathList& pathList)\r
 {\r
-#if 0\r
+\r
        pathList.Clear();\r
        int nListItems = GetItemCount();\r
        for (int i=0; i< nListItems; i++)\r
        {\r
-               const FileEntry* entry = GetListEntry(i);\r
+               CTGitPath * entry = (CTGitPath*)GetItemData(i);\r
                ASSERT(entry != NULL);\r
-               if (entry->IsChecked())\r
+               if (entry->m_Checked)\r
                {\r
-                       pathList.AddPath(entry->path);\r
+                       pathList.AddPath(*entry);\r
                }\r
        }\r
        pathList.SortByPathname();\r
-#endif\r
+\r
 }\r
 \r
 \r
index 137250c..4bf10c1 100644 (file)
@@ -138,12 +138,13 @@ UINT CAddDlg::AddThread()
        // and show the ones which the user can add (i.e. the unversioned ones)\r
        DialogEnableWindow(IDOK, false);\r
        m_bCancelled = false;\r
-       if (!m_addListCtrl.GetStatus(m_pathList))\r
+       m_addListCtrl.Clear();\r
+       if (!m_addListCtrl.GetStatus(m_pathList,false,false,true,true))\r
        {\r
                m_addListCtrl.SetEmptyString(m_addListCtrl.GetLastErrorMessage());\r
        }\r
        m_addListCtrl.Show(SVNSLC_SHOWUNVERSIONED | SVNSLC_SHOWDIRECTFILES | SVNSLC_SHOWREMOVEDANDPRESENT, \r
-                                               SVNSLC_SHOWUNVERSIONED | SVNSLC_SHOWDIRECTFILES | SVNSLC_SHOWREMOVEDANDPRESENT);\r
+                                               SVNSLC_SHOWUNVERSIONED | SVNSLC_SHOWDIRECTFILES | SVNSLC_SHOWREMOVEDANDPRESENT,true,true);\r
 \r
        InterlockedExchange(&m_bThreadRunning, FALSE);\r
        return 0;\r
index 775d5f8..63a0772 100644 (file)
@@ -22,6 +22,7 @@
 #include "AddDlg.h"\r
 #include "SVNProgressDlg.h"\r
 #include "ShellUpdater.h"\r
+#include "messagebox.h"\r
 \r
 bool AddCommand::Execute()\r
 {\r
@@ -54,6 +55,21 @@ bool AddCommand::Execute()
                        dlg.m_pathList = pathList;\r
                        if (dlg.DoModal() == IDOK)\r
                        {\r
+                               CString cmd,out;\r
+                               int success=0;\r
+                               for(int i=0;i<dlg.m_pathList.GetCount();i++)\r
+                               {\r
+                                       cmd.Format(_T("git.exe add \"%s\""),dlg.m_pathList[i].GetGitPathString());\r
+                                       if(g_Git.Run(cmd,&out,CP_OEMCP))\r
+                                       {\r
+                                               CMessageBox::Show(NULL,out,_T("TortoiseGit"),MB_OK|MB_ICONERROR);\r
+                                       }\r
+                                       success++;\r
+                               }\r
+                               CString message;\r
+                               message.Format(_T("%d file added"),success);\r
+                               CMessageBox::Show(NULL,message,_T("TortoiseGit"),MB_OK);\r
+                               return TRUE;\r
 #if 0\r
                                if (dlg.m_pathList.GetCount() == 0)\r
                                        return FALSE;\r