return true;\r
}\r
return false;\r
+}\r
+\r
+int CAppUtils::SaveCommitUnicodeFile(CString &filename, CString &message)\r
+{\r
+ CFile file(filename,CFile::modeReadWrite|CFile::modeCreate );\r
+ CString cmd,output;\r
+ int cp=CP_UTF8;\r
+\r
+ cmd=_T("git.exe config i18n.commitencoding");\r
+ if(g_Git.Run(cmd,&output,CP_ACP))\r
+ cp=CP_UTF8;\r
+ \r
+ int start=0;\r
+ output=output.Tokenize(_T("\n"),start);\r
+ cp=CUnicodeUtils::GetCPCode(output); \r
+\r
+ int len=message.GetLength();\r
+\r
+ char * buf;\r
+ buf = new char[len*4 + 4];\r
+ SecureZeroMemory(buf, (len*4 + 4));\r
+\r
+ int lengthIncTerminator = WideCharToMultiByte(cp, 0, message, -1, buf, len*4, NULL, NULL);\r
+\r
+ file.Write(buf,lengthIncTerminator-1);\r
+ file.Close();\r
+ delete buf;\r
+ return 0;\r
}
\ No newline at end of file
static CString ChooseRepository(CString *path);\r
\r
static bool SendPatchMail(CTGitPathList &pathlist,bool autoclose=false);\r
+\r
+ static int SaveCommitUnicodeFile(CString &filename, CString &mesage);\r
\r
private:\r
static CString PickDiffTool(const CTGitPath& file1, const CTGitPath& file2);\r
// g_Git.Run(cmd,&out);\r
\r
CString tempfile=::GetTempFile();\r
- CFile file(tempfile,CFile::modeReadWrite|CFile::modeCreate );\r
- CStringA log=CUnicodeUtils::GetUTF8( m_sLogMessage);\r
- file.Write(log,log.GetLength());\r
+ \r
+ CAppUtils::SaveCommitUnicodeFile(tempfile,m_sLogMessage);\r
//file.WriteString(m_sLogMessage);\r
- file.Close();\r
+ \r
\r
out =_T("");\r
CString amend;\r
\r
};\r
static CodeMap *p=map;\r
+ codename=codename.MakeLower();\r
while(p->m_CodeName != NULL)\r
{\r
- if(CString(p->m_CodeName).MakeLower() == codename)\r
+ CString str = p->m_CodeName;\r
+ str=str.MakeLower();\r
+\r
+ if( str == codename)\r
return p->m_Code;\r
p++;\r
}\r