1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2018 - TortoiseGit
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
31 typedef int CALL_UPDATE_DIFF_ASYNC(GitRevLoglist
* pRev
, IAsyncDiffCB
* data
);
33 class GitRevLoglist
: public GitRev
36 friend class CLogCache
;
43 unsigned int m_Action
;
44 CTGitPathList m_Files
;
45 CTGitPathList m_UnRevFiles
;
48 GIT_COMMIT m_GitCommit
;
53 CString m_Ref
; // for Refloglist
54 CString m_RefAction
; // for Refloglist
56 // Show version tree Graphic
57 std::vector
<int> m_Lanes
;
59 volatile LONG m_IsFull
;
60 volatile LONG m_IsUpdateing
;
61 volatile LONG m_IsCommitParsed
;
62 volatile LONG m_IsDiffFiles
;
64 CALL_UPDATE_DIFF_ASYNC
*m_CallDiffAsync
;
68 if (!m_IsDiffFiles
&& !m_CommitHash
.IsEmpty())
71 ret
= SafeFetchFullInfo(&g_Git
);
72 InterlockedExchange(&m_IsDiffFiles
, TRUE
);
74 InterlockedExchange(&m_IsFull
, TRUE
);
81 unsigned int& GetAction(IAsyncDiffCB
* data
)
84 if (!m_IsDiffFiles
&& m_CallDiffAsync
)
85 m_CallDiffAsync(this, data
);
91 int& GetRebaseAction()
93 return m_RebaseAction
;
96 CTGitPathList
& GetFiles(IAsyncDiffCB
* data
)
99 if (data
&& !m_IsDiffFiles
&& m_CallDiffAsync
)
100 m_CallDiffAsync(this, data
);
106 CTGitPathList
& GetUnRevFiles()
112 void CheckAndParser()
114 if (!m_IsCommitParsed
&& m_GitCommit
.m_pGitCommit
)
116 ParserFromCommit(&m_GitCommit
);
117 InterlockedExchange(&m_IsCommitParsed
, TRUE
);
118 git_free_commit(&m_GitCommit
);
120 InterlockedExchange(&m_IsFull
, TRUE
);
125 CString
& GetAuthorName()
131 CString
& GetAuthorEmail()
134 return m_AuthorEmail
;
137 CTime
& GetAuthorDate()
143 CString
& GetCommitterName()
146 return m_CommitterName
;
149 CString
& GetCommitterEmail()
152 return m_CommitterEmail
;
155 CTime
& GetCommitterDate()
158 return m_CommitterDate
;
161 CString
& GetSubject()
173 CString
GetSubjectBody(bool crlf
= false)
176 CString
ret(m_Subject
);
186 CString
body(m_Body
);
187 body
.Replace(L
"\n", L
"\r\n");
188 ret
+= body
.TrimRight();
193 BOOL
IsBoundary() { return m_Mark
== L
'-'; }
195 virtual void Clear() override
;
197 int SafeFetchFullInfo(CGit
* git
);
199 int SafeGetSimpleList(CGit
* git
);
200 volatile LONG m_IsSimpleListReady
;
201 STRING_VECTOR m_SimpleFileList
; /* use for find and filter, no rename detection and line num stat info */
203 static int GetRefLog(const CString
& ref
, std::vector
<GitRevLoglist
>& refloglist
, CString
& error
);