OSDN Git Service

Share resource file between TortoiseGitBlame and TortoiseProc
[tortoisegit/TortoiseGitJp.git] / src / Git / GitRev.cpp
index a0bf2da..bc9aee3 100644 (file)
@@ -33,6 +33,7 @@ void GitRev::Clear()
        m_Body.Empty();\r
        m_Subject.Empty();\r
        m_CommitHash.Empty();\r
+       m_Mark=0;\r
 \r
 }\r
 int GitRev::CopyFrom(GitRev &rev)\r
@@ -49,6 +50,7 @@ int GitRev::CopyFrom(GitRev &rev)
        m_ParentHash    =rev.m_ParentHash       ;\r
        m_Files                 =rev.m_Files                    ;       \r
        m_Action                =rev.m_Action           ;\r
+       m_Mark                  =rev.m_Mark;\r
        return 0;\r
 }\r
 int GitRev::ParserFromLog(CString &log)\r
@@ -58,7 +60,7 @@ int GitRev::ParserFromLog(CString &log)
        CString key;\r
        CString text;\r
        CString filelist;\r
-       TCHAR mode;\r
+       TCHAR mode=0;\r
        CTGitPath  path;\r
        this->m_Files.Clear();\r
     m_Action=0;\r
@@ -100,10 +102,21 @@ int GitRev::ParserFromLog(CString &log)
                                this->m_Body = text +_T("\n");\r
                                break;\r
                        case LOG_REV_COMMIT_HASH:\r
-                               this->m_CommitHash = text;\r
+                               this->m_CommitHash = text.Right(40);\r
+                               if(text.GetLength()>40)\r
+                               {\r
+                                       this->m_Mark=text[0];\r
+                               }\r
                                break;\r
                        case LOG_REV_COMMIT_PARENT:\r
-                               this->m_ParentHash.insert(this->m_ParentHash.end(),text);\r
+                               while(text.GetLength()>0)\r
+                               {\r
+                                       this->m_ParentHash.insert(this->m_ParentHash.end(),text.Left(40));\r
+                                       if(text.GetLength()>40)\r
+                                               text=text.Right(text.GetLength()-41);\r
+                                       else\r
+                                               break;\r
+                               }\r
                                break;\r
                        case LOG_REV_COMMIT_FILE:\r
                                break;\r
@@ -141,19 +154,24 @@ CTime GitRev::ConverFromString(CString input)
 \r
 int GitRev::SafeFetchFullInfo(CGit *git)\r
 {\r
-       if(InterlockedExchange(&m_IsUpdateing,TRUE) == FALSE)
-       {
-               //GitRev rev;
-               CString onelog;
-               git->GetLog(onelog,m_CommitHash,1);
-               CString oldhash=m_CommitHash;
-               ParserFromLog(onelog);
-               
-               ASSERT(oldhash==m_CommitHash);
-
-               InterlockedExchange(&m_IsUpdateing,FALSE);
-               InterlockedExchange(&m_IsFull,TRUE);
-               return 0;
-       }
+       if(InterlockedExchange(&m_IsUpdateing,TRUE) == FALSE)\r
+       {\r
+               //GitRev rev;\r
+               CString onelog;\r
+               TCHAR oldmark=this->m_Mark;\r
+       \r
+               git->GetLog(onelog,m_CommitHash,NULL,1);\r
+               CString oldhash=m_CommitHash;\r
+               ParserFromLog(onelog);\r
+               \r
+               //ASSERT(oldhash==m_CommitHash);\r
+               if(oldmark!=0)\r
+                       this->m_Mark=oldmark;  //parser full log will cause old mark overwrited. \r
+                                                              //So we need keep old bound mark.\r
+\r
+               InterlockedExchange(&m_IsUpdateing,FALSE);\r
+               InterlockedExchange(&m_IsFull,TRUE);\r
+               return 0;\r
+       }\r
        return -1;\r
 }
\ No newline at end of file