OSDN Git Service

Fix TortoiseGitBlame commit is not in log list problem.
[tortoisegit/TortoiseGitJp.git] / src / Git / TGitPath.cpp
index a31dca5..af6a4ab 100644 (file)
@@ -81,6 +81,7 @@ CTGitPath::CTGitPath(const CString& sUnknownPath) :
 {\r
        SetFromUnknown(sUnknownPath);\r
        m_Action=0;\r
+       m_Stage=0;\r
 }\r
 \r
 int CTGitPath::ParserAction(BYTE action)\r
@@ -97,7 +98,10 @@ int CTGitPath::ParserAction(BYTE action)
                m_Action|= LOGACTIONS_DELETED;\r
        if(action == 'U')\r
                m_Action|= LOGACTIONS_UNMERGED;\r
-\r
+       if(action == 'K')\r
+               m_Action|= LOGACTIONS_DELETED;\r
+       if(action == 'H')\r
+               m_Action|= LOGACTIONS_CACHE;\r
        return m_Action;\r
 }\r
 void CTGitPath::SetFromGit(const char* pPath)\r
@@ -827,6 +831,43 @@ CTGitPathList::CTGitPathList(const CTGitPath& firstEntry)
 {\r
        AddPath(firstEntry);\r
 }\r
+int CTGitPathList::ParserFromLsFile(BYTE_VECTOR &out,bool staged)\r
+{\r
+       int pos=0;\r
+       CString one;\r
+       CTGitPath path;\r
+       CString part;\r
+       while(pos>=0 && pos<out.size())\r
+       {\r
+               one.Empty();\r
+               path.Reset();\r
+\r
+               g_Git.StringAppend(&one,&out[pos],CP_OEMCP);\r
+               int tabstart=0;\r
+               path.m_Action=path.ParserAction(out[pos]);\r
+               one.Tokenize(_T("\t"),tabstart); \r
+\r
+               if(tabstart>=0)\r
+                       path.SetFromGit(one.Right(one.GetLength()-tabstart));\r
+\r
+               tabstart=0;\r
+\r
+               part=one.Tokenize(_T(" "),tabstart); //Tag\r
+\r
+               part=one.Tokenize(_T(" "),tabstart); //Mode\r
+               \r
+               part=one.Tokenize(_T(" "),tabstart); //Hash\r
+\r
+               part=one.Tokenize(_T("\t"),tabstart); //Stage\r
+\r
+               path.m_Stage=_ttol(part);\r
+\r
+               this->AddPath(path);\r
+\r
+               pos=out.findNextString(pos);\r
+       }\r
+       return pos;\r
+}\r
 int CTGitPathList::FillUnRev(int action,CTGitPathList *list)\r
 {\r
        int pos=0;\r
@@ -849,23 +890,25 @@ int CTGitPathList::FillUnRev(int action,CTGitPathList *list)
                \r
                if(list==NULL)\r
                {\r
-                       cmd=_T("git.exe ls-files --exclude-standard --full-name --others");\r
+                       cmd=_T("git.exe ls-files --exclude-standard --full-name --others -z");\r
                        cmd+=ignored;\r
                        \r
                }\r
                else\r
-               {       cmd.Format(_T("git.exe ls-files --exclude-standard --full-name --others %s-- \"%s\""),\r
+               {       cmd.Format(_T("git.exe ls-files --exclude-standard --full-name --others -z %s-- \"%s\""),\r
                                        ignored,\r
                                        (*list)[i].GetWinPathString());\r
                }\r
-#ifdef VECTOR_F                \r
-               CString out;\r
-               g_Git.Run(cmd,&out);\r
 \r
+               BYTE_VECTOR out;\r
+               out.clear();\r
+               g_Git.Run(cmd,&out);\r
+               \r
+               pos=0;\r
                CString one;\r
-               while( pos>=0 )\r
+               while( pos>=0 && pos<out.size())\r
                {\r
-                       one=out.Tokenize(_T("\n"),pos);\r
+                       g_Git.StringAppend(&one,&out[pos],CP_OEMCP);\r
                        if(!one.IsEmpty())\r
                        {\r
                                //SetFromGit will clear all status\r
@@ -873,8 +916,9 @@ int CTGitPathList::FillUnRev(int action,CTGitPathList *list)
                                path.m_Action=action;\r
                                AddPath(path);\r
                        }\r
+                       pos=out.findNextString(pos);\r
                }\r
-#endif\r
+\r
        }\r
        return 0;\r
 }\r
@@ -1806,6 +1850,8 @@ CString CTGitPath::GetActionName()
                return _T("Added");\r
        if(m_Action  & CTGitPath::LOGACTIONS_DELETED)\r
                return _T("Deleted");\r
+       if(m_Action  & CTGitPath::LOGACTIONS_UNMERGED)\r
+               return _T("Conflict");\r
        if(m_Action  & CTGitPath::LOGACTIONS_MODIFIED)\r
                return _T("Modified");\r
        if(m_Action  & CTGitPath::LOGACTIONS_REPLACED)\r