Commit 8b0c1be7 authored by Sven Strickroth's avatar Sven Strickroth

Do less memory allocations and copying

Signed-off-by: Sven Strickroth's avatarSven Strickroth <email@cs-ware.de>
parent 0b88c659
......@@ -193,7 +193,7 @@ int CGitIndexList::GetFileStatus(const CString &gitdir, const CString &pathorg,
}
if (callback && status && assumeValid && skipWorktree)
callback(gitdir + _T("\\") + pathorg, *status, false, pData, *assumeValid, *skipWorktree);
callback(CombinePath(gitdir, pathorg), *status, false, pData, *assumeValid, *skipWorktree);
return 0;
}
......@@ -213,13 +213,13 @@ int CGitIndexList::GetStatus(const CString &gitdir,const CString &pathParam, git
if (path.IsEmpty())
result = g_Git.GetFileModifyTime(gitdir, &time, &isDir);
else
result = g_Git.GetFileModifyTime(gitdir + _T("\\") + path, &time, &isDir, &filesize);
result = g_Git.GetFileModifyTime(CombinePath(gitdir, path), &time, &isDir, &filesize);
if (result)
{
*status = git_wc_status_deleted;
if (callback && assumeValid && skipWorktree)
callback(gitdir + _T("\\") + path, git_wc_status_deleted, false, pData, *assumeValid, *skipWorktree);
callback(CombinePath(gitdir, path), git_wc_status_deleted, false, pData, *assumeValid, *skipWorktree);
return 0;
}
......@@ -242,13 +242,13 @@ int CGitIndexList::GetStatus(const CString &gitdir,const CString &pathParam, git
{
*status = git_wc_status_normal;
if (callback)
callback(gitdir + _T("\\") + path, *status, false, pData, (at(i).m_Flags & GIT_IDXENTRY_VALID) && !(at(i).m_Flags & GIT_IDXENTRY_SKIP_WORKTREE), (at(i).m_Flags & GIT_IDXENTRY_SKIP_WORKTREE) != 0);
callback(CombinePath(gitdir, path), *status, false, pData, (at(i).m_Flags & GIT_IDXENTRY_VALID) && !(at(i).m_Flags & GIT_IDXENTRY_SKIP_WORKTREE), (at(i).m_Flags & GIT_IDXENTRY_SKIP_WORKTREE) != 0);
return 0;
}
else
{
result = g_Git.GetFileModifyTime(gitdir + _T("\\") + at(i).m_FileName, &time, nullptr, &filesize);
result = g_Git.GetFileModifyTime(CombinePath(gitdir, at(i).m_FileName), &time, nullptr, &filesize);
if (result)
continue;
......@@ -260,7 +260,7 @@ int CGitIndexList::GetStatus(const CString &gitdir,const CString &pathParam, git
GetFileStatus(gitdir, at(i).m_FileName, status, time, filesize, callback, pData, NULL, assumeValid, skipWorktree);
// if a file is assumed valid, we need to inform the caller, otherwise the assumevalid flag might not get to the explorer on first open of a repository
if (callback && assumeValid && skipWorktree && (*assumeValid || *skipWorktree))
callback(gitdir + _T("\\") + path, *status, false, pData, *assumeValid, *skipWorktree);
callback(CombinePath(gitdir, path), *status, false, pData, *assumeValid, *skipWorktree);
if (*status != git_wc_status_none)
{
if (dirstatus == git_wc_status_none)
......@@ -287,7 +287,7 @@ int CGitIndexList::GetStatus(const CString &gitdir,const CString &pathParam, git
*status = git_wc_status_unversioned;
}
if(callback)
callback(gitdir + _T("\\") + path, *status, false, pData, false, false);
callback(CombinePath(gitdir, path), *status, false, pData, false, false);
return 0;
......@@ -305,7 +305,8 @@ int CGitIndexFileMap::Check(const CString &gitdir, bool *isChanged)
__int64 time;
int result;
CString IndexFile = g_AdminDirMap.GetAdminDir(gitdir) + _T("index");
CString IndexFile = g_AdminDirMap.GetAdminDir(gitdir);
IndexFile += _T("index");
/* Get data associated with "crt_stat.c": */
result = g_Git.GetFileModifyTime(IndexFile, &time);
......@@ -521,7 +522,8 @@ int CGitHeadFileList::ReadHeadHash(CString gitdir)
CAutoWriteLock lock(m_SharedMutex);
m_Gitdir = g_AdminDirMap.GetAdminDir(gitdir);
m_HeadFile = m_Gitdir + _T("HEAD");
m_HeadFile = m_Gitdir;
m_HeadFile += _T("HEAD");
if( g_Git.GetFileModifyTime(m_HeadFile, &m_LastModifyTimeHead))
return -1;
......@@ -1004,7 +1006,8 @@ int CGitIgnoreList::LoadAllIgnoreFile(const CString &gitdir, const CString &path
}
CString adminDir = g_AdminDirMap.GetAdminDir(tempOrig);
CString wcglobalgitignore = adminDir + _T("info\\exclude");
CString wcglobalgitignore = adminDir;
wcglobalgitignore += _T("info\\exclude");
if (CheckFileChanged(wcglobalgitignore))
{
FetchIgnoreFile(gitdir, wcglobalgitignore, true);
......@@ -1203,7 +1206,8 @@ int CGitIgnoreList::CheckIgnore(const CString &path, const CString &projectroot,
break;
CString adminDir = g_AdminDirMap.GetAdminDir(tempOrig);
CString wcglobalgitignore = adminDir + _T("info\\exclude");
CString wcglobalgitignore = adminDir;
wcglobalgitignore += _T("info\\exclude");
if ((ret = CheckFileAgainstIgnoreList(wcglobalgitignore, patha, base, type)) != -1)
break;
......
......@@ -167,6 +167,26 @@ public:
return m_Body;
}
CString GetSubjectBody(bool crlf = false)
{
CheckAndParser();
CString ret(m_Subject);
if (!crlf)
{
ret += _T("\n\n");
ret += m_Body;
}
else
{
ret.TrimRight();
ret += _T("\r\n\r\n");
CString body(m_Body);
body.Replace(_T("\n"), _T("\r\n"));
ret += body.TrimRight();
}
return ret;
}
BOOL IsBoundary() { return m_Mark == _T('-'); }
virtual void Clear();
......
......@@ -218,7 +218,7 @@ int GitStatus::GetFileStatus(const CString &gitdir, const CString &pathParam, gi
{
*status =st;
if (callback && assumeValid && skipWorktree)
callback(gitdir + _T("/") + path, st, false, pData, *assumeValid, *skipWorktree);
callback(CombinePath(gitdir, path), st, false, pData, *assumeValid, *skipWorktree);
return 0;
}
......@@ -228,7 +228,7 @@ int GitStatus::GetFileStatus(const CString &gitdir, const CString &pathParam, gi
{
*status = git_wc_status_unversioned;
if (callback && assumeValid && skipWorktree)
callback(gitdir + _T("/") + path, *status, false, pData, *assumeValid, *skipWorktree);
callback(CombinePath(gitdir, path), *status, false, pData, *assumeValid, *skipWorktree);
return 0;
}
......@@ -242,7 +242,7 @@ int GitStatus::GetFileStatus(const CString &gitdir, const CString &pathParam, gi
}
*status = st;
if (callback && assumeValid && skipWorktree)
callback(gitdir + _T("/") + path, st, false, pData, *assumeValid, *skipWorktree);
callback(CombinePath(gitdir, path), st, false, pData, *assumeValid, *skipWorktree);
return 0;
}
......@@ -265,7 +265,7 @@ int GitStatus::GetFileStatus(const CString &gitdir, const CString &pathParam, gi
*status =st=git_wc_status_added;
CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) _T(": File miss in head tree %s"), (LPCTSTR)path);
if (callback && assumeValid && skipWorktree)
callback(gitdir + _T("/") + path, st, false, pData, *assumeValid, *skipWorktree);
callback(CombinePath(gitdir, path), st, false, pData, *assumeValid, *skipWorktree);
return 0;
}
......@@ -274,7 +274,7 @@ int GitStatus::GetFileStatus(const CString &gitdir, const CString &pathParam, gi
{
*status =st=git_wc_status_modified;
if (callback && assumeValid && skipWorktree)
callback(gitdir + _T("/") + path, st, false, pData, *assumeValid, *skipWorktree);
callback(CombinePath(gitdir, path), st, false, pData, *assumeValid, *skipWorktree);
return 0;
}
}
......@@ -282,7 +282,7 @@ int GitStatus::GetFileStatus(const CString &gitdir, const CString &pathParam, gi
}
*status =st;
if (callback && assumeValid && skipWorktree)
callback(gitdir + _T("/") + path, st, false, pData, *assumeValid, *skipWorktree);
callback(CombinePath(gitdir, path), st, false, pData, *assumeValid, *skipWorktree);
return 0;
}
}
......@@ -339,10 +339,11 @@ static bool SortFileName(CGitFileName &Item1, CGitFileName &Item2)
return Item1.m_FileName.Compare(Item2.m_FileName)<0;
}
int GitStatus::GetFileList(const CString &gitdir, const CString &subpath, std::vector<CGitFileName> &list)
int GitStatus::GetFileList(CString path, std::vector<CGitFileName> &list)
{
path += _T("\\*.*");
WIN32_FIND_DATA data;
HANDLE handle = ::FindFirstFileEx(gitdir + _T("\\") + subpath + _T("\\*.*"), SysInfo::Instance().IsWin7OrLater() ? FindExInfoBasic : FindExInfoStandard, &data, FindExSearchNameMatch, nullptr, SysInfo::Instance().IsWin7OrLater() ? FIND_FIRST_EX_LARGE_FETCH : 0);
HANDLE handle = ::FindFirstFileEx(path, SysInfo::Instance().IsWin7OrLater() ? FindExInfoBasic : FindExInfoStandard, &data, FindExSearchNameMatch, nullptr, SysInfo::Instance().IsWin7OrLater() ? FIND_FIRST_EX_LARGE_FETCH : 0);
do
{
if(_tcscmp(data.cFileName, _T(".git")) == 0)
......@@ -385,11 +386,8 @@ int GitStatus::EnumDirStatus(const CString &gitdir, const CString &subpath, git_
if(path[path.GetLength()-1] != _T('/'))
path += _T('/'); //Add trail / to show it is directory, not file name.
CString lowcasepath = path;
lowcasepath.MakeLower();
std::vector<CGitFileName> filelist;
GetFileList(gitdir, subpath, filelist);
GetFileList(CombinePath(gitdir, subpath), filelist);
if(status)
{
......@@ -407,7 +405,8 @@ int GitStatus::EnumDirStatus(const CString &gitdir, const CString &subpath, git_
{
for (it = filelist.begin(); it < filelist.end(); ++it)
{
CString casepath = path + it->m_CaseFileName;
CString casepath = path;
casepath += it->m_CaseFileName;
bool bIsDir = false;
if (it->m_FileName.GetLength() > 0 && it->m_FileName[it->m_FileName.GetLength() - 1] == _T('/'))
......@@ -431,17 +430,19 @@ int GitStatus::EnumDirStatus(const CString &gitdir, const CString &subpath, git_
*status = git_wc_status_unversioned;
if(callback)
callback(gitdir + _T("/") + casepath, *status, bIsDir, pData, false, false);
callback(CombinePath(gitdir, casepath), *status, bIsDir, pData, false, false);
}
return 0;
}
CString lowcasepath = path;
lowcasepath.MakeLower();
CString onepath;
CString casepath;
for (it = filelist.begin(); it < filelist.end(); ++it)
{
casepath=onepath = path;
onepath.MakeLower();
casepath = onepath = lowcasepath;
onepath += it->m_FileName;
casepath += it->m_CaseFileName;
......@@ -464,7 +465,7 @@ int GitStatus::EnumDirStatus(const CString &gitdir, const CString &subpath, git_
{
*status = git_wc_status_unversioned;
if(callback)
callback(gitdir + _T("/") + casepath, *status, bIsDir, pData, false, false);
callback(CombinePath(gitdir, casepath), *status, bIsDir, pData, false, false);
continue;
}
......@@ -477,14 +478,14 @@ int GitStatus::EnumDirStatus(const CString &gitdir, const CString &subpath, git_
*status = git_wc_status_unversioned;
if(callback)
callback(gitdir + _T("/") + casepath, *status, bIsDir, pData, false, false);
callback(CombinePath(gitdir, casepath), *status, bIsDir, pData, false, false);
}
else if(pos <0 && posintree>=0) /* check if file delete in index */
{
*status = git_wc_status_deleted;
if(callback)
callback(gitdir + _T("/") + casepath, *status, bIsDir, pData, false, false);
callback(CombinePath(gitdir, casepath), *status, bIsDir, pData, false, false);
}
else if(pos >=0 && posintree <0) /* Check if file added */
......@@ -493,7 +494,7 @@ int GitStatus::EnumDirStatus(const CString &gitdir, const CString &subpath, git_
if (indexptr->at(pos).m_Flags & GIT_IDXENTRY_STAGEMASK)
*status = git_wc_status_conflicted;
if(callback)
callback(gitdir + _T("/") + casepath, *status, bIsDir, pData, false, false);
callback(CombinePath(gitdir, casepath), *status, bIsDir, pData, false, false);
}
else
{
......@@ -504,7 +505,7 @@ int GitStatus::EnumDirStatus(const CString &gitdir, const CString &subpath, git_
{
*status = git_wc_status_normal;
if(callback)
callback(gitdir + _T("/") + casepath, *status, bIsDir, pData, false, false);
callback(CombinePath(gitdir, casepath), *status, bIsDir, pData, false, false);
}
else
{
......@@ -551,7 +552,7 @@ int GitStatus::EnumDirStatus(const CString &gitdir, const CString &subpath, git_
*status = git_wc_status_normal;
}
if(callback)
callback(gitdir + _T("/") + (*it2).m_FileName, *status, false, pData, false, skipWorktree);
callback(CombinePath(gitdir, (*it2).m_FileName), *status, false, pData, false, skipWorktree);
}
}
}
......@@ -581,7 +582,7 @@ int GitStatus::EnumDirStatus(const CString &gitdir, const CString &subpath, git_
{
*status = git_wc_status_deleted;
if(callback)
callback(gitdir + _T("/") + (*it2).m_FileName, *status, false, pData, false, false);
callback(CombinePath(gitdir, (*it2).m_FileName), *status, false, pData, false, false);
}
}
}
......@@ -606,9 +607,6 @@ int GitStatus::GetDirStatus(const CString &gitdir, const CString &subpath, git_w
if(path[path.GetLength()-1] != _T('/'))
path += _T('/'); //Add trail / to show it is directory, not file name.
CString lowcasepath = path;
lowcasepath.MakeLower();
if(status)
{
g_IndexFileMap.CheckAndUpdate(gitdir, true);
......@@ -621,6 +619,9 @@ int GitStatus::GetDirStatus(const CString &gitdir, const CString &subpath, git_w
return 0;
}
CString lowcasepath = path;
lowcasepath.MakeLower();
int pos = SearchInSortVector(*indexptr, lowcasepath, lowcasepath.GetLength());
//Not In Version Contorl
......@@ -630,7 +631,7 @@ int GitStatus::GetDirStatus(const CString &gitdir, const CString &subpath, git_w
{
*status = git_wc_status_unversioned;
if(callback)
callback(gitdir + _T("/") + path, *status, false, pData, false, false);
callback(CombinePath(gitdir, path), *status, false, pData, false, false);
return 0;
}
//Check ignore always.
......@@ -678,7 +679,7 @@ int GitStatus::GetDirStatus(const CString &gitdir, const CString &subpath, git_w
{
int dirpos = (*it).m_FileName.Find(_T('/'), path.GetLength());
if(dirpos<0 || IsRecursive)
callback(gitdir + _T("\\") + it->m_FileName, git_wc_status_conflicted, false, pData, false, false);
callback(CombinePath(gitdir, it->m_FileName), git_wc_status_conflicted, false, pData, false, false);
}
else
break;
......@@ -713,7 +714,7 @@ int GitStatus::GetDirStatus(const CString &gitdir, const CString &subpath, git_w
{
int dirpos = (*it).m_FileName.Find(_T('/'), path.GetLength());
if(dirpos<0 || IsRecursive)
callback(gitdir + _T("\\") + it->m_FileName, git_wc_status_added, false, pData, false, false);
callback(CombinePath(gitdir, it->m_FileName), git_wc_status_added, false, pData, false, false);
}
else
......@@ -727,7 +728,7 @@ int GitStatus::GetDirStatus(const CString &gitdir, const CString &subpath, git_w
{
int dirpos = (*it).m_FileName.Find(_T('/'), path.GetLength());
if(dirpos<0 || IsRecursive)
callback(gitdir + _T("\\") + it->m_FileName, git_wc_status_modified, false, pData, ((*it).m_Flags & GIT_IDXENTRY_VALID) && !((*it).m_Flags & GIT_IDXENTRY_SKIP_WORKTREE), ((*it).m_Flags & GIT_IDXENTRY_SKIP_WORKTREE) != 0);
callback(CombinePath(gitdir, it->m_FileName), git_wc_status_modified, false, pData, ((*it).m_Flags & GIT_IDXENTRY_VALID) && !((*it).m_Flags & GIT_IDXENTRY_SKIP_WORKTREE), ((*it).m_Flags & GIT_IDXENTRY_SKIP_WORKTREE) != 0);
}
else
......@@ -791,7 +792,7 @@ int GitStatus::GetDirStatus(const CString &gitdir, const CString &subpath, git_w
{
sub = currentPath;
CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) _T(": index subdir %s\n"), (LPCTSTR)sub);
if(callback) callback(gitdir + _T("\\") + sub,
if (callback) callback(CombinePath(gitdir, sub),
git_wc_status_normal, true, pData, false, false);
}
continue;
......@@ -807,7 +808,7 @@ int GitStatus::GetDirStatus(const CString &gitdir, const CString &subpath, git_w
}
}
if(callback) callback(gitdir + _T("/") + subpath, *status, true, pData, false, false);
if (callback) callback(CombinePath(gitdir, path), *status, true, pData, false, false);
}
}catch(...)
......
......@@ -84,6 +84,14 @@ typedef struct git_wc_status2_t
typedef BOOL (*FILL_STATUS_CALLBACK)(const CString &path, git_wc_status_kind status, bool isDir, void *pdata, bool assumeValid, bool skipWorktree);
static CString CombinePath(const CString& part1, const CString& part2)
{
CString path(part1);
path += _T('\\');
path += part2;
return path;
}
/**
* \ingroup Git
* Handles git status of working copies.
......@@ -95,7 +103,7 @@ public:
static int GetFileStatus(const CString &gitdir, const CString &path, git_wc_status_kind * status, BOOL IsFull = false, BOOL IsRecursive = false, BOOL isIgnore = true, FILL_STATUS_CALLBACK callback = nullptr, void *pData = nullptr, bool * assumeValid = nullptr, bool * skipWorktree = nullptr);
static int GetDirStatus(const CString &gitdir, const CString &path, git_wc_status_kind * status, BOOL IsFull = false, BOOL IsRecursive = false, BOOL isIgnore = true, FILL_STATUS_CALLBACK callback = nullptr, void *pData = nullptr);
static int EnumDirStatus(const CString &gitdir, const CString &path, git_wc_status_kind * status, BOOL IsFull = false, BOOL IsRecursive = false, BOOL isIgnore = true, FILL_STATUS_CALLBACK callback = nullptr, void *pData = nullptr);
static int GetFileList(const CString &gitdir, const CString &path, std::vector<CGitFileName> &list);
static int GetFileList(CString path, std::vector<CGitFileName> &list);
static bool HasIgnoreFilesChanged(const CString &gitdir, const CString &subpaths, bool isDir);
static int LoadIgnoreFile(const CString &gitdir, const CString &subpaths, bool isDir);
static int IsUnderVersionControl(const CString &gitdir, const CString &path, bool isDir,bool *isVersion);
......
......@@ -80,7 +80,11 @@ bool CMassiveGitTaskBase::ExecuteCommands(volatile BOOL& cancel)
{
CString add;
for (int j = firstCombine; j <= i; ++j)
add += _T(" \"") + GetListItem(j) + _T("\"");
{
add += _T(" \"");
add += GetListItem(j);
add += _T('"');
}
CString cmd, out;
cmd.Format(_T("git.exe %s %s%s"), (LPCTSTR)m_sParams, m_bIsPath ? _T("--") : _T(""), (LPCTSTR)add);
......
......@@ -741,7 +741,9 @@ void CTGitPath::AppendPathString(const CString& sAppend)
cleanAppend.Replace('/', '\\');
cleanAppend.TrimLeft('\\');
m_sBackslashPath.TrimRight('\\');
CString strCopy = m_sBackslashPath + _T("\\") + cleanAppend;
CString strCopy = m_sBackslashPath;
strCopy += _T('\\');
strCopy += cleanAppend;
SetFromWin(strCopy);
}
......
......@@ -590,7 +590,10 @@ CCachedDirectory::GetCacheKey(const CTGitPath& path)
CString
CCachedDirectory::GetFullPathString(const CString& cacheKey)
{
return m_directoryPath.GetWinPathString() + _T("\\") + cacheKey;
CString fullpath(m_directoryPath.GetWinPathString());
fullpath += _T('\\');
fullpath += cacheKey;
return fullpath;
}
BOOL CCachedDirectory::GetStatusCallback(const CString & path, git_wc_status_kind status,bool isDir, void *, bool assumeValid, bool skipWorktree)
......
......@@ -1588,12 +1588,13 @@ CString CGitLogListBase::MessageDisplayStr(GitRev* pLogEntry)
if (!m_bFullCommitMessageOnLogLine || pLogEntry->GetBody().IsEmpty())
return pLogEntry->GetSubject();
CString txt;
txt.Format(L"%s %s", (LPCTSTR)pLogEntry->GetSubject(), (LPCTSTR)pLogEntry->GetBody());
CString txt(pLogEntry->GetSubject());
txt += _T(' ');
txt += pLogEntry->GetBody();
// Deal with CRLF
txt.Replace(_T("\n"), _T(" "));
txt.Replace(_T("\r"), _T(" "));
txt.Replace(_T('\n'), _T(' '));
txt.Replace(_T('\r'), _T(' '));
return txt;
}
......@@ -1696,11 +1697,11 @@ void CGitLogListBase::OnLvnGetdispinfoLoglist(NMHDR *pNMHDR, LRESULT *pResult)
break;
case LOGLIST_BUG: //Bug ID
if(pLogEntry)
lstrcpyn(pItem->pszText, (LPCTSTR)this->m_ProjectProperties.FindBugID(pLogEntry->GetSubject() + _T("\r\n\r\n") + pLogEntry->GetBody()), pItem->cchTextMax - 1);
lstrcpyn(pItem->pszText, (LPCTSTR)this->m_ProjectProperties.FindBugID(pLogEntry->GetSubjectBody()), pItem->cchTextMax - 1);
break;
case LOGLIST_SVNREV: //SVN revision
if (pLogEntry)
lstrcpyn(pItem->pszText, (LPCTSTR)FindSVNRev(pLogEntry->GetSubject() + _T("\r\n\r\n") + pLogEntry->GetBody()), pItem->cchTextMax - 1);
lstrcpyn(pItem->pszText, (LPCTSTR)FindSVNRev(pLogEntry->GetSubjectBody()), pItem->cchTextMax - 1);
break;
default:
......@@ -2069,7 +2070,7 @@ void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point)
if(branchs.size() == 1)
{
str2 += _T(" ");
str2 += _T(' ');
str2 += _T('"') + branchs[0]->Mid(11) + _T('"');
popup.AppendMenuIcon(ID_SWITCHBRANCH, str2, IDI_SWITCH);
......@@ -2279,7 +2280,7 @@ void CGitLogListBase::OnContextMenu(CWnd* pWnd, CPoint point)
if (branchs.size() == 1)
{
str.LoadString(IDS_DELETE_BRANCHTAG_SHORT);
str+=_T(" ");
str+=_T(' ');
str += *branchs[0];
popup.AppendMenuIcon(ID_DELETE, str, IDI_DELETE);
popup.SetMenuItemData(ID_DELETE, (ULONG_PTR)branchs[0]);
......@@ -2394,7 +2395,8 @@ void CGitLogListBase::CopySelectionToClipBoard(int toCopy)
{
CString rename;
rename.Format(from, (LPCTSTR)((CTGitPath&)pLogEntry->GetFiles(this)[cpPathIndex]).GetGitOldPathString());
sPaths += _T(" ") + rename;
sPaths += _T(' ');
sPaths += rename;
}
sPaths += _T("\r\n");
}
......@@ -2402,23 +2404,25 @@ void CGitLogListBase::CopySelectionToClipBoard(int toCopy)
CString body = pLogEntry->GetBody();
body.Replace(_T("\n"), _T("\r\n"));
sLogCopyText.Format(_T("%s: %s\r\n%s: %s <%s>\r\n%s: %s\r\n%s:\r\n%s\r\n----\r\n%s\r\n\r\n"),
(LPCTSTR)sRev, pLogEntry->m_CommitHash.ToString(),
(LPCTSTR)sRev, (LPCTSTR)pLogEntry->m_CommitHash.ToString(),
(LPCTSTR)sAuthor, (LPCTSTR)pLogEntry->GetAuthorName(), (LPCTSTR)pLogEntry->GetAuthorEmail(),
(LPCTSTR)sDate,
(LPCTSTR)CLoglistUtils::FormatDateAndTime(pLogEntry->GetAuthorDate(), m_DateFormat, true, m_bRelativeTimes),
(LPCTSTR)sMessage, (pLogEntry->GetSubject().Trim() + _T("\r\n\r\n") + body.Trim()).Trim(),
(LPCTSTR)sMessage, (LPCTSTR)pLogEntry->GetSubjectBody(true),
(LPCTSTR)sPaths);
sClipdata += sLogCopyText;
}
else if (toCopy == ID_COPY_MESSAGE)
{
CString body = pLogEntry->GetBody();
body.Replace(_T("\n"), _T("\r\n"));
sClipdata += _T("* ") + (pLogEntry->GetSubject().Trim() + _T("\r\n\r\n") + body.Trim()).Trim() + _T("\r\n\r\n");
sClipdata += _T("* ");
sClipdata += pLogEntry->GetSubjectBody(true);
sClipdata += _T("\r\n\r\n");
}
else if (toCopy == ID_COPY_SUBJECT)
{
sClipdata += _T("* ") + pLogEntry->GetSubject().Trim() + _T("\r\n\r\n");
sClipdata += _T("* ");
sClipdata += pLogEntry->GetSubject().Trim();
sClipdata += _T("\r\n\r\n");
}
else
{
......@@ -3177,7 +3181,7 @@ BOOL CGitLogListBase::IsMatchFilter(bool bRegex, GitRevLoglist* pRev, std::tr1::
{
if(this->m_bShowBugtraqColumn)
{
CString sBugIds = m_ProjectProperties.FindBugID(pRev->GetSubject() + _T("\r\n\r\n") + pRev->GetBody());
CString sBugIds = m_ProjectProperties.FindBugID(pRev->GetSubjectBody());
ATLTRACE(_T("bugID = \"%s\"\n"), (LPCTSTR)sBugIds);
if (std::regex_search(std::wstring(sBugIds), pat, flags))
......@@ -3298,7 +3302,7 @@ BOOL CGitLogListBase::IsMatchFilter(bool bRegex, GitRevLoglist* pRev, std::tr1::
{
if(this->m_bShowBugtraqColumn)
{
CString sBugIds = m_ProjectProperties.FindBugID(pRev->GetSubject() + _T("\r\n\r\n") + pRev->GetBody());
CString sBugIds = m_ProjectProperties.FindBugID(pRev->GetSubjectBody());
if (!m_bFilterCaseSensitively)
sBugIds.MakeLower();
......@@ -4020,30 +4024,30 @@ LRESULT CGitLogListBase::OnFindDialogMessage(WPARAM /*wParam*/, LPARAM /*lParam*
CString str;
str+=pLogEntry->m_CommitHash.ToString();
str+=_T("\n");
str += _T('\n');
for (size_t j = 0; j < this->m_HashMap[pLogEntry->m_CommitHash].size(); ++j)
{
str+=m_HashMap[pLogEntry->m_CommitHash][j];
str+=_T("\n");
str += _T('\n');
}
str+=pLogEntry->GetAuthorEmail();
str+=_T("\n");
str += _T('\n');
str+=pLogEntry->GetAuthorName();
str+=_T("\n");
str += _T('\n');
str+=pLogEntry->GetBody();
str+=_T("\n");
str += _T('\n');
str+=pLogEntry->GetCommitterEmail();
str+=_T("\n");
str += _T('\n');
str+=pLogEntry->GetCommitterName();
str+=_T("\n");
str += _T('\n');
str+=pLogEntry->GetSubject();
str+=_T("\n");
str += _T('\n');
str+=pLogEntry->m_Notes;
str+=_T("\n");
str += _T('\n');
str+=GetTagInfo(pLogEntry);
str+=_T("\n");
str += _T('\n');