From 654a5f1a7160ea349cfe48fef683ec7695271c2d Mon Sep 17 00:00:00 2001 From: Frank Li Date: Fri, 14 Aug 2009 21:52:43 +0800 Subject: [PATCH] Fixed Issue #141: Bizarre ordering in commit dialog? Signed-off-by: Frank Li --- src/Git/GitStatusListCtrl.cpp | 7 ++++++ src/Git/GitStatusListCtrl.h | 8 +++++++ src/TortoiseProc/GitStatusListCtrlHelpers.cpp | 32 ++++++++++++++------------- 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/src/Git/GitStatusListCtrl.cpp b/src/Git/GitStatusListCtrl.cpp index a1e3cc9d4..531a44e29 100644 --- a/src/Git/GitStatusListCtrl.cpp +++ b/src/Git/GitStatusListCtrl.cpp @@ -1047,6 +1047,13 @@ void CGitStatusListCtrl::Show(DWORD dwShow, DWORD dwCheck /*=0*/, bool bShowFold m_arStatusArray.push_back((CTGitPath*)&m_IgnoreFileList[i]); } } + + if( m_nSortedColumn ) + { + CSorter predicate (&m_ColumnManager, m_nSortedColumn, m_bAscending); + std::sort(m_arStatusArray.begin(), m_arStatusArray.end(), predicate); + } + int index =0; for(int i=0;im_arStatusArray.size();i++) { diff --git a/src/Git/GitStatusListCtrl.h b/src/Git/GitStatusListCtrl.h index 130d7bf13..40af64f2b 100644 --- a/src/Git/GitStatusListCtrl.h +++ b/src/Git/GitStatusListCtrl.h @@ -519,6 +519,14 @@ public: bool operator() ( const CTGitPath* entry1 , const CTGitPath* entry2) const; + static int A2L(const CString &str) + { + if(str==_T("-")) + return -1; + else + return _ttol(str); + } + private: ColumnManager* columnManager; diff --git a/src/TortoiseProc/GitStatusListCtrlHelpers.cpp b/src/TortoiseProc/GitStatusListCtrlHelpers.cpp index 348f28e5b..15ef7adb1 100644 --- a/src/TortoiseProc/GitStatusListCtrlHelpers.cpp +++ b/src/TortoiseProc/GitStatusListCtrlHelpers.cpp @@ -970,84 +970,86 @@ bool CGitStatusListCtrl::CSorter::operator() // result = entry1->last_commit_author.CompareNoCase(entry2->last_commit_author); } } - case 11: + case 11: //Del Number { if (result == 0) { // result = entry1->lock_comment.CompareNoCase(entry2->lock_comment); + result = A2L(entry1->m_StatDel)-A2L(entry2->m_StatDel); } } - case 10: + case 10: //Add Number { if (result == 0) { -// result = entry1->lock_owner.CompareNoCase(entry2->lock_owner); + //result = entry1->lock_owner.CompareNoCase(entry2->lock_owner); + result = A2L(entry1->m_StatAdd)-A2L(entry2->m_StatAdd); } } - case 9: + case 9: //Modification Data { if (result == 0) { // result = entry1->url.CompareNoCase(entry2->url); } } - case 8: + case 8: //Data { if (result == 0) { // result = entry1->remotepropstatus - entry2->remotepropstatus; } } - case 7: + case 7: // Version { if (result == 0) { // result = entry1->remotetextstatus - entry2->remotetextstatus; } } - case 6: + case 6: // Author { if (result == 0) { // result = entry1->propstatus - entry2->propstatus; } } - case 5: + case 5: //Prop Status { if (result == 0) { // result = entry1->textstatus - entry2->textstatus; } - } - case 4: + } + case 4: //Text Status { if (result == 0) { // result = entry1->remotestatus - entry2->remotestatus; } } - case 3: + case 3: // Status { if (result == 0) { - // result = entry1->status - entry2->status; + result = entry1->GetActionName(entry1->m_Action).CompareNoCase(entry2->GetActionName(entry2->m_Action)); } } - case 2: + case 2: //Ext file { if (result == 0) { result = entry1->GetFileExtension().CompareNoCase(entry2->GetFileExtension()); } } - case 1: + case 1: // File name { if (result == 0) { result = entry1->GetFileOrDirectoryName().CompareNoCase(entry2->GetFileOrDirectoryName()); } } - case 0: // path column + case 0: // Full path column { if (result == 0) { -- 2.11.4.GIT