1
// TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2017, 2019-2023 - 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.
25 #include "GitMailmap.h"
27 using GIT_REV_LIST
= std::vector
<CGitHash
>;
29 #define LOG_REV_AUTHOR_NAME L'0'
30 #define LOG_REV_AUTHOR_EMAIL L'1'
31 #define LOG_REV_AUTHOR_DATE L'2'
32 #define LOG_REV_COMMIT_NAME L'3'
33 #define LOG_REV_COMMIT_EMAIL L'4'
34 #define LOG_REV_COMMIT_DATE L'5'
35 #define LOG_REV_COMMIT_SUBJECT L'6'
36 #define LOG_REV_COMMIT_BODY L'7'
37 #define LOG_REV_COMMIT_HASH L'8'
38 #define LOG_REV_COMMIT_PARENT L'9'
39 #define LOG_REV_COMMIT_FILE L'A'
40 #define LOG_REV_ITEM_BEGIN L'B'
41 #define LOG_REV_ITEM_END L'C'
47 CString m_AuthorEmail
;
49 CString m_CommitterName
;
50 CString m_CommitterEmail
;
51 CTime m_CommitterDate
;
59 CString
GetAuthorName() const
64 CString
GetAuthorEmail() const
69 CTime
GetAuthorDate() const
74 CString
GetCommitterName() const
76 return m_CommitterName
;
79 CString
GetCommitterEmail() const
81 return m_CommitterEmail
;
84 CTime
GetCommitterDate() const
86 return m_CommitterDate
;
89 CString
GetSubject() const
94 CString
GetBody() const
103 REV_HEAD
= -1, ///< head revision
104 REV_BASE
= -2, ///< base revision
105 REV_WC
= -3, ///< revision of the working copy
106 REV_UNSPECIFIED
= -4, ///< unspecified revision
109 static CString
GetHead() { return L
"HEAD"; };
110 static CString
GetWorkingCopy() { return GIT_REV_ZERO
; };
112 CGitHash m_CommitHash
;
113 GIT_REV_LIST m_ParentHash
;
115 virtual void Clear();
116 inline int ParentsCount() const { return static_cast<int>(m_ParentHash
.size()); }
119 int ParserFromCommit(const GIT_COMMIT
* commit
);
120 int ParserParentFromCommit(const GIT_COMMIT
* commit
);
122 int ParserFromCommit(const git_commit
* commit
);
123 int ParserParentFromCommit(const git_commit
* commit
);
124 int GetCommitFromHash(git_repository
* repo
, const CGitHash
& hash
);
125 int GetCommit(git_repository
* repo
, const CString
& Rev
);
128 int GetParentFromHash(const CGitHash
& hash
);
129 int GetCommitFromHash(const CGitHash
& hash
);
130 int GetCommit(const CString
& rev
);
132 CString
GetLastErr() const { return m_sErr
; }
134 void ApplyMailmap(const CGitMailmap
& mailmap
= CGitMailmap());
141 int GetCommitFromHash_withoutLock(const CGitHash
& hash
);