From: Frank Li Date: Fri, 8 Jan 2010 14:38:19 +0000 (+0800) Subject: gitdll call basic work X-Git-Url: http://git.sourceforge.jp/view?p=tortoisegit%2FTortoiseGitJp.git;a=commitdiff_plain;h=4ee531c909596917f1f849ab14898de22ec74b11 gitdll call basic work Signed-off-by: Frank Li --- diff --git a/ext/gitdll/gitdll.c b/ext/gitdll/gitdll.c index 3d60256..29bba8a 100644 --- a/ext/gitdll/gitdll.c +++ b/ext/gitdll/gitdll.c @@ -214,7 +214,7 @@ int git_get_commit_first_parent(GIT_COMMIT *commit,GIT_COMMIT_LIST *list) int git_get_commit_next_parent(GIT_COMMIT_LIST *list, GIT_HASH hash) { struct commit_list *l = *(struct commit_list **)list; - if(list == NULL) + if(list == NULL || l==NULL) return -1; if(hash) diff --git a/src/Git/Git.cpp b/src/Git/Git.cpp index baea8f9..737c60a 100644 --- a/src/Git/Git.cpp +++ b/src/Git/Git.cpp @@ -473,7 +473,7 @@ int CGit::GetLog(BYTE_VECTOR& logOut, CString &hash, CTGitPath *path ,int count return GetLog(&gitCall,hash,path,count,mask,from,to); } -CString CGit::GetLogCmd( 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; @@ -533,13 +533,23 @@ CString CGit::GetLogCmd( CString &hash, CTGitPath *path, int count, int mask,CSt } 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; + } return cmd; } diff --git a/src/Git/Git.h b/src/Git/Git.h index 425f5e4..2f2f659 100644 --- a/src/Git/Git.h +++ b/src/Git/Git.h @@ -131,7 +131,7 @@ public: CString *from=NULL,CString *to=NULL); CString GetLogCmd(CString &hash, CTGitPath *path = NULL,int count=-1,int InfoMask=LOG_INFO_FULL_DIFF|LOG_INFO_STAT|LOG_INFO_FILESTATE|LOG_INFO_BOUNDARY|LOG_INFO_DETECT_COPYRENAME|LOG_INFO_SHOW_MERGEDFILE, - CString *from=NULL,CString *to=NULL); + CString *from=NULL,CString *to=NULL, bool paramonly=false); BOOL EnumFiles(const TCHAR *pszProjectPath, const TCHAR *pszSubPath, unsigned int nFlags, WGENUMFILECB *pEnumCb, void *pUserData); diff --git a/src/TortoiseProc/GitLogCache.cpp b/src/TortoiseProc/GitLogCache.cpp index 70145be..10c740b 100644 --- a/src/TortoiseProc/GitLogCache.cpp +++ b/src/TortoiseProc/GitLogCache.cpp @@ -25,7 +25,8 @@ GitRev * CLogCache::GetCacheData(CGitHash &hash) { return &m_HashMap[hash]; } - return NULL; + m_HashMap[hash].m_CommitHash=hash; + return &m_HashMap[hash]; } else { @@ -37,7 +38,8 @@ GitRev * CLogCache::GetCacheData(CGitHash &hash) return &m_HashMap[hash]; } } - return NULL; + m_HashMap[hash].m_CommitHash=hash; + return &m_HashMap[hash]; } int CLogCache::FetchCacheIndex(CString GitDir) { diff --git a/src/TortoiseProc/GitLogListBase.cpp b/src/TortoiseProc/GitLogListBase.cpp index 58700ed..1c55845 100644 --- a/src/TortoiseProc/GitLogListBase.cpp +++ b/src/TortoiseProc/GitLogListBase.cpp @@ -1748,6 +1748,7 @@ int CGitLogListBase::BeginFetchLog() ClearText(); this->m_logEntries.ClearAll(); + git_init(); m_LogCache.FetchCacheIndex(g_Git.m_CurrentDir); @@ -1763,10 +1764,16 @@ int CGitLogListBase::BeginFetchLog() // if(this->m_bAllBranch) mask |= m_ShowMask; + this->m_arShownList.RemoveAll(); + if(m_bShowWC) + { this->m_logEntries.insert(m_logEntries.begin(),this->m_wcRev.m_CommitHash); + this->m_LogCache.m_HashMap[m_wcRev.m_CommitHash]=m_wcRev; + m_arShownList.Add(&m_wcRev); + } - CString cmd=g_Git.GetLogCmd(m_StartRef,path,-1,mask); + CString cmd=g_Git.GetLogCmd(m_StartRef,path,-1,mask,NULL,NULL,true); //this->m_logEntries.ParserFromLog(); if(IsInWorkingThread()) @@ -1777,8 +1784,6 @@ int CGitLogListBase::BeginFetchLog() { SetItemCountEx(this->m_logEntries.size()); } - - this->m_arShownList.RemoveAll(); if(git_open_log(&m_DllGitLog,CUnicodeUtils::GetMulti(cmd,CP_ACP).GetBuffer())) { @@ -2071,6 +2076,7 @@ UINT CGitLogListBase::LogThread() } } + git_get_log_firstcommit(m_DllGitLog); GIT_COMMIT commit; t1=GetTickCount(); @@ -2105,14 +2111,14 @@ UINT CGitLogListBase::LogThread() { //update UI oldsize = m_logEntries.size(); - PostMessage(LVM_SETITEMCOUNT, (WPARAM) this->m_logEntries.size(),(LPARAM) LVSICF_NOINVALIDATEALL); - ::PostMessage(this->GetParent()->m_hWnd,MSG_LOAD_PERCENTAGE,(WPARAM) GITLOG_END,0); + //PostMessage(LVM_SETITEMCOUNT, (WPARAM) this->m_logEntries.size(),(LPARAM) LVSICF_NOINVALIDATEALL); + //::PostMessage(this->GetParent()->m_hWnd,MSG_LOAD_PERCENTAGE,(WPARAM) GITLOG_END,0); } } //Update UI; - PostMessage(LVM_SETITEMCOUNT, (WPARAM) this->m_logEntries.size(),(LPARAM) LVSICF_NOINVALIDATEALL); - ::PostMessage(this->GetParent()->m_hWnd,MSG_LOAD_PERCENTAGE,(WPARAM) GITLOG_END,0); + //PostMessage(LVM_SETITEMCOUNT, (WPARAM) this->m_logEntries.size(),(LPARAM) LVSICF_NOINVALIDATEALL); + //::PostMessage(this->GetParent()->m_hWnd,MSG_LOAD_PERCENTAGE,(WPARAM) GITLOG_END,0); InterlockedExchange(&m_bThreadRunning, FALSE);