X-Git-Url: http://git.osdn.net/view?a=blobdiff_plain;f=src%2FGit%2FGit.cpp;h=3353b5442e0c559a7aecacbbcfba26f420853105;hb=588f1a6cb8ca51c1318db041bd0f228c84be313e;hp=46bfb662d6f6204d16bf656f57116e25bf4b4cad;hpb=f07fa9f8716d582d3a1fd282dde5f317a62f3664;p=tortoisegit%2FTortoiseGitJp.git diff --git a/src/Git/Git.cpp b/src/Git/Git.cpp index 46bfb66..3353b54 100644 --- a/src/Git/Git.cpp +++ b/src/Git/Git.cpp @@ -6,9 +6,11 @@ #include "GitConfig.h" #include #include "UnicodeUtils.h" +#include "gitdll.h" int CGit::m_LogEncode=CP_UTF8; + static LPTSTR nextpath(LPCTSTR src, LPTSTR dst, UINT maxlen) { LPCTSTR orgsrc; @@ -126,12 +128,18 @@ CGit::CGit(void) { GetCurrentDirectory(MAX_DIRBUFFER,m_CurrentDir.GetBuffer(MAX_DIRBUFFER)); m_CurrentDir.ReleaseBuffer(); - + m_IsGitDllInited = false; + m_GitDiff=0; CheckMsysGitDir(); } CGit::~CGit(void) { + if(this->m_GitDiff) + { + git_close_diff(m_GitDiff); + m_GitDiff=0; + } } static char g_Buffer[4096]; @@ -472,10 +480,8 @@ int CGit::GetLog(BYTE_VECTOR& logOut, CString &hash, CTGitPath *path ,int count return GetLog(&gitCall,hash,path,count,mask,from,to); } -//int CGit::GetLog(CGitCall* pgitCall, CString &hash, CTGitPath *path ,int count,int mask) -int CGit::GetLog(CGitCall* pgitCall, CString &hash, CTGitPath *path, int count, int mask,CString *from,CString *to) +CString CGit::GetLogCmd( CString &hash, CTGitPath *path, int count, int mask,CString *from,CString *to,bool paramonly) { - CString cmd; CString log; CString num; @@ -534,40 +540,35 @@ int CGit::GetLog(CGitCall* pgitCall, CString &hash, CTGitPath *path, int count, } param+=hash; - cmd.Format(_T("git.exe log %s -z --topo-order %s --parents --pretty=format:\""), + if(paramonly) + cmd.Format(_T("%s -z --topo-order %s --parents "), + num,param); + else + cmd.Format(_T("git.exe log %s -z --topo-order %s --parents --pretty=format:\""), num,param); BuildOutputFormat(log,!(mask&CGit::LOG_INFO_ONLY_HASH)); - cmd += log; - cmd += CString(_T("\" "))+hash+file; + if(paramonly) + { + cmd += hash+file; + }else + { + cmd += log; + cmd += CString(_T("\" "))+hash+file; + } - pgitCall->SetCmd(cmd); + return cmd; +} +//int CGit::GetLog(CGitCall* pgitCall, CString &hash, CTGitPath *path ,int count,int mask) +int CGit::GetLog(CGitCall* pgitCall, CString &hash, CTGitPath *path, int count, int mask,CString *from,CString *to) +{ + pgitCall->SetCmd( GetLogCmd(hash,path,count,mask,from,to) ); return Run(pgitCall); // return Run(cmd,&logOut); } -#if 0 -int CGit::GetShortLog(CString &logOut,CTGitPath * path, int count) -{ - CString cmd; - CString log; - int n; - if(count<0) - n=100; - else - n=count; - cmd.Format(_T("git.exe log --left-right --boundary --topo-order -n%d --pretty=format:\""),n); - BuildOutputFormat(log,false); - cmd += log+_T("\""); - if (path) - cmd+= _T(" -- \"")+path->GetGitPathString()+_T("\""); - //cmd += CString(_T("\" HEAD~40..HEAD")); - return Run(cmd,&logOut); -} -#endif - #define BUFSIZE 512 void GetTempPath(CString &path) { @@ -1157,11 +1158,11 @@ BOOL CGit::EnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsig CString sSubPath = pszSubPath; sSubPath.Replace(_T('\\'), _T('/')); - cmd.Format(_T("igit.exe \"%s\" status %s \"%s\""), sProjectPath, sMode, sSubPath); + cmd.Format(_T("tgit.exe statusex \"%s\" status %s \"%s\""), sProjectPath, sMode, sSubPath); } else { - cmd.Format(_T("igit.exe \"%s\" status %s"), sProjectPath, sMode); + cmd.Format(_T("tgit.exe statusex \"%s\" status %s"), sProjectPath, sMode); } //OutputDebugStringA("---");OutputDebugStringW(cmd);OutputDebugStringA("\r\n");