OSDN Git Service

Fix Copy and rename parse file list problem.
authorFrank Li <lznuaa@gmail.com>
Wed, 11 Feb 2009 15:55:38 +0000 (23:55 +0800)
committerFrank Li <lznuaa@gmail.com>
Wed, 11 Feb 2009 16:00:48 +0000 (00:00 +0800)
Also fix Issue 41:  Crash when diffing from log
Add copy status.
Add log cache version number to force refresh cache data, because cache data may be wrong if there are rename and copy

Signed-off-by: Frank Li <lznuaa@gmail.com>
src/Git/GitStatusListCtrl.cpp
src/Git/GitStatusListCtrl.h
src/Git/TGitPath.cpp
src/Git/TGitPath.h
src/TortoiseProc/gitlogcache.h

index a32d859..077eedd 100644 (file)
@@ -1449,7 +1449,7 @@ void CGitStatusListCtrl::AddEntry(CTGitPath * GitPath, WORD langID, int listInde
        // relative path\r
        CString rename;\r
        rename.Format(_T("(from %s)"),GitPath->GetGitOldPathString());\r
-       if(GitPath->m_Action & CTGitPath::LOGACTIONS_REPLACED)\r
+       if(GitPath->m_Action & (CTGitPath::LOGACTIONS_REPLACED|CTGitPath::LOGACTIONS_COPY))\r
                entryname+=rename;\r
        \r
        InsertItem(index, entryname, icon_idx);\r
@@ -2060,7 +2060,7 @@ bool CGitStatusListCtrl::BuildStatistics()
        {\r
                int status=((CTGitPath*)m_arStatusArray[i])->m_Action;\r
 \r
-               if(status&CTGitPath::LOGACTIONS_ADDED)\r
+               if(status&(CTGitPath::LOGACTIONS_ADDED|CTGitPath::LOGACTIONS_COPY))\r
                        m_nAdded++;\r
                \r
                if(status&CTGitPath::LOGACTIONS_DELETED)\r
@@ -4248,7 +4248,7 @@ void CGitStatusListCtrl::StartDiff(int fileindex)
 \r
        CTGitPath file1=*(CTGitPath*)GetItemData(fileindex);\r
        CTGitPath file2;\r
-       if(file1.m_Action & CTGitPath::LOGACTIONS_REPLACED)\r
+       if(file1.m_Action & (CTGitPath::LOGACTIONS_REPLACED|CTGitPath::LOGACTIONS_COPY))\r
        {\r
                file2.SetFromGit(file1.GetGitOldPathString());\r
        }else\r
@@ -4526,11 +4526,11 @@ void CGitStatusListCtrl::OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult)
                                {\r
                                        crText = m_Colors.GetColor(CColors::Conflict);\r
 \r
-                               }else if(entry->m_Action & CTGitPath::LOGACTIONS_MODIFIED)\r
+                               }else if(entry->m_Action & (CTGitPath::LOGACTIONS_MODIFIED))\r
                                {\r
                                        crText = m_Colors.GetColor(CColors::Modified);\r
 \r
-                               }else if(entry->m_Action & CTGitPath::LOGACTIONS_ADDED)\r
+                               }else if(entry->m_Action & (CTGitPath::LOGACTIONS_ADDED|CTGitPath::LOGACTIONS_COPY))\r
                                {\r
                                        crText = m_Colors.GetColor(CColors::Added);\r
                                }\r
index 70938f3..8223e7a 100644 (file)
@@ -55,8 +55,8 @@
                \r
 #define SVNSLC_SHOWUNVERSIONED CTGitPath::LOGACTIONS_UNVER\r
 #define SVNSLC_SHOWNORMAL              0x000000000\r
-#define SVNSLC_SHOWMODIFIED            CTGitPath::LOGACTIONS_MODIFIED\r
-#define SVNSLC_SHOWADDED               CTGitPath::LOGACTIONS_ADDED\r
+#define SVNSLC_SHOWMODIFIED            (CTGitPath::LOGACTIONS_MODIFIED)\r
+#define SVNSLC_SHOWADDED               (CTGitPath::LOGACTIONS_ADDED|CTGitPath::LOGACTIONS_COPY)\r
 #define SVNSLC_SHOWREMOVED             CTGitPath::LOGACTIONS_DELETED\r
 #define SVNSLC_SHOWCONFLICTED  CTGitPath::LOGACTIONS_UNMERGED\r
 #define SVNSLC_SHOWMISSING             0x00000000\r
index fceb025..b86b56b 100644 (file)
@@ -102,6 +102,9 @@ int CTGitPath::ParserAction(BYTE action)
                m_Action|= LOGACTIONS_DELETED;\r
        if(action == 'H')\r
                m_Action|= LOGACTIONS_CACHE;\r
+       if(action == 'C' )\r
+               m_Action|= LOGACTIONS_COPY;\r
+\r
        return m_Action;\r
 }\r
 void CTGitPath::SetFromGit(const char* pPath)\r
@@ -1052,6 +1055,7 @@ int CTGitPathList::ParserFromLog(BYTE_VECTOR &log)
                                        sec++;\r
                                        g_Git.StringAppend(&file1,&log[sec],CP_OEMCP);\r
                                }\r
+                               pos=sec;\r
 \r
                        }else\r
                        {\r
@@ -1874,6 +1878,9 @@ CString CTGitPath::GetActionName()
                return _T("Modified");\r
        if(m_Action  & CTGitPath::LOGACTIONS_REPLACED)\r
                return _T("Rename");\r
+       if(m_Action  & CTGitPath::LOGACTIONS_COPY)\r
+               return _T("Copy");\r
+\r
        return _T("Unknown");\r
 }\r
 \r
index 01df547..0e16fe2 100644 (file)
@@ -17,6 +17,7 @@ public:
                LOGACTIONS_DELETED      = 0x00000008,\r
                LOGACTIONS_UNMERGED = 0x00000010,\r
                LOGACTIONS_CACHE        = 0x00000020,\r
+               LOGACTIONS_COPY         = 0x00000040,\r
                LOGACTIONS_UNVER        = 0x80000000,\r
                LOGACTIONS_IGNORE       = 0x40000000,\r
                //LOGACTIONS_CONFLICT = 0x20000000,\r
index 901a880..1cd672a 100644 (file)
@@ -8,7 +8,7 @@
 #define LOG_DATA_MAGIC         0x99aa00FF\r
 #define LOG_DATA_ITEM_MAGIC 0x0F8899CC\r
 #define LOG_DATA_FILE_MAGIC 0x19999FFF\r
-#define LOG_INDEX_VERSION 0x1\r
+#define LOG_INDEX_VERSION   0x2 \r
 \r
 struct SLogCacheIndexHeader \r
 {\r