Commit e3b9a127 authored by Sven Strickroth's avatar Sven Strickroth

CPatch: No need to parse whole patch if we only want to know the subject

Signed-off-by: Sven Strickroth's avatarSven Strickroth <email@cs-ware.de>
parent 4ed905c8
......@@ -36,7 +36,7 @@ int CSendMailPatch::SendAsSingleMail(CTGitPath &path, CGitProgressList * instanc
CString pathfile(path.GetWinPathString());
CPatch patch;
if (patch.Parse(pathfile))
if (patch.Parse(pathfile, !m_bAttachment))
{
instance->ReportError(_T("Could not open/parse ") + pathfile);
return -2;
......@@ -61,7 +61,7 @@ int CSendMailPatch::SendAsCombinedMail(CTGitPathList &list, CGitProgressList * i
for (int i = 0; i < list.GetCount(); ++i)
{
CPatch patch;
if (patch.Parse((CString &)list[i].GetWinPathString()))
if (patch.Parse((CString&)list[i].GetWinPathString(), !m_bAttachment))
{
instance->ReportError(_T("Could not open/parse ") + list[i].GetWinPathString());
return -2;
......@@ -96,10 +96,8 @@ CPatch::~CPatch()
{
}
int CPatch::Parse(CString &pathfile)
int CPatch::Parse(CString& pathfile, bool parseBody)
{
CString str;
m_PathFile = pathfile;
CFile PatchFile;
......@@ -141,6 +139,9 @@ int CPatch::Parse(CString &pathfile)
}
}
if (!parseBody)
return 0;
if (start + 1 < m_Body.GetLength())
CGit::StringAppend(&m_strBody, (BYTE*)(LPCSTR)m_Body + start + 1, CP_UTF8, m_Body.GetLength() - start - 1);
}
......
......@@ -38,7 +38,7 @@ public:
CPatch();
~CPatch(void);
int Parse(CString &pathfile);
int Parse(CString& pathfile, bool parseBody);
CString m_Author;
CString m_Date;
CString m_Subject;
......
......@@ -201,7 +201,7 @@ void CSendMailDlg::UpdateSubject()
if(this->m_MapPatch.find(index) == m_MapPatch.end() )
{
CString pathfile=m_ctrlList.GetItemText(index,0);
m_MapPatch[index].Parse(pathfile);
m_MapPatch[index].Parse(pathfile, false);
}
GetDlgItem(IDC_SENDMAIL_SUBJECT)->SetWindowText(m_MapPatch[index].m_Subject);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment