OSDN Git Service

Fixed Issue #141: Bizarre ordering in commit dialog?
authorFrank Li <lznuaa@gmail.com>
Fri, 14 Aug 2009 13:52:43 +0000 (21:52 +0800)
committerFrank Li <lznuaa@gmail.com>
Fri, 14 Aug 2009 13:52:43 +0000 (21:52 +0800)
Signed-off-by: Frank Li <lznuaa@gmail.com>
src/Git/GitStatusListCtrl.cpp
src/Git/GitStatusListCtrl.h
src/TortoiseProc/GitStatusListCtrlHelpers.cpp

index a1e3cc9..531a44e 100644 (file)
@@ -1047,6 +1047,13 @@ void CGitStatusListCtrl::Show(DWORD dwShow, DWORD dwCheck /*=0*/, bool bShowFold
                        m_arStatusArray.push_back((CTGitPath*)&m_IgnoreFileList[i]);\r
                }\r
        }\r
+\r
+       if( m_nSortedColumn )\r
+       {\r
+               CSorter predicate (&m_ColumnManager, m_nSortedColumn, m_bAscending);\r
+               std::sort(m_arStatusArray.begin(), m_arStatusArray.end(), predicate);\r
+       }\r
+\r
        int index =0;\r
        for(int i=0;i<this->m_arStatusArray.size();i++)\r
        {\r
index 130d7bf..40af64f 100644 (file)
@@ -519,6 +519,14 @@ public:
         bool operator() ( const CTGitPath* entry1\r
                         , const CTGitPath* entry2) const;\r
 \r
+               static int A2L(const CString &str)\r
+               {\r
+                       if(str==_T("-"))\r
+                               return -1;\r
+                       else\r
+                               return _ttol(str);\r
+               }\r
+\r
     private:\r
 \r
         ColumnManager* columnManager;\r
index 348f28e..15ef7ad 100644 (file)
@@ -970,84 +970,86 @@ bool CGitStatusListCtrl::CSorter::operator()
 //                             result = entry1->last_commit_author.CompareNoCase(entry2->last_commit_author);\r
                        }\r
                }\r
-       case 11:\r
+       case 11: //Del Number\r
                {\r
                        if (result == 0)\r
                        {\r
 //                             result = entry1->lock_comment.CompareNoCase(entry2->lock_comment);\r
+                               result = A2L(entry1->m_StatDel)-A2L(entry2->m_StatDel);\r
                        }\r
                }\r
-       case 10:\r
+       case 10: //Add Number\r
                {\r
                        if (result == 0)\r
                        {\r
-//                             result = entry1->lock_owner.CompareNoCase(entry2->lock_owner);\r
+                               //result = entry1->lock_owner.CompareNoCase(entry2->lock_owner);\r
+                               result = A2L(entry1->m_StatAdd)-A2L(entry2->m_StatAdd);\r
                        }\r
                }\r
-       case 9:\r
+       case 9:  //Modification Data\r
                {\r
                        if (result == 0)\r
                        {\r
 //                             result = entry1->url.CompareNoCase(entry2->url);\r
                        }\r
                }\r
-       case 8:\r
+       case 8: //Data\r
                {\r
                        if (result == 0)\r
                        {\r
 //                             result = entry1->remotepropstatus - entry2->remotepropstatus;\r
                        }\r
                }\r
-       case 7:\r
+       case 7: // Version\r
                {\r
                        if (result == 0)\r
                        {\r
 //                             result = entry1->remotetextstatus - entry2->remotetextstatus;\r
                        }\r
                }\r
-       case 6:\r
+       case 6:  // Author\r
                {\r
                        if (result == 0)\r
                        {\r
 //                             result = entry1->propstatus - entry2->propstatus;\r
                        }\r
                }\r
-       case 5:\r
+       case 5: //Prop Status\r
                {\r
                        if (result == 0)\r
                        {\r
 //                             result = entry1->textstatus - entry2->textstatus;\r
                        }\r
-               }\r
-       case 4:\r
+               } \r
+       case 4: //Text Status\r
                {\r
                        if (result == 0)\r
                        {\r
        //                      result = entry1->remotestatus - entry2->remotestatus;\r
                        }\r
                }\r
-       case 3:\r
+       case 3: // Status\r
                {\r
                        if (result == 0)\r
                        {\r
-       //                      result = entry1->status - entry2->status;\r
+                               result = entry1->GetActionName(entry1->m_Action).CompareNoCase(entry2->GetActionName(entry2->m_Action));\r
                        }\r
                }\r
-       case 2:\r
+       case 2:  //Ext file \r
                {\r
                        if (result == 0)\r
                        {\r
                                result = entry1->GetFileExtension().CompareNoCase(entry2->GetFileExtension());\r
                        }\r
                }\r
-       case 1:\r
+       case 1:    // File name\r
                {\r
                        if (result == 0)\r
                        {\r
                                result = entry1->GetFileOrDirectoryName().CompareNoCase(entry2->GetFileOrDirectoryName());\r
                        }\r
                }\r
-       case 0:         // path column\r
+       case 0:         // Full path column\r
                {\r
                        if (result == 0)\r
                        {\r