From 09f91b1b0cc2b9bb99b58e1e2bd1474f96fd59c5 Mon Sep 17 00:00:00 2001 From: Frank Li Date: Sat, 10 Apr 2010 15:12:12 +0800 Subject: [PATCH] Fix explore crash when there are ignore patten at .git/info/exclude Signed-off-by: Frank Li --- src/Git/GitIndex.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/Git/GitIndex.cpp b/src/Git/GitIndex.cpp index c88885c5f..8f8122619 100644 --- a/src/Git/GitIndex.cpp +++ b/src/Git/GitIndex.cpp @@ -646,6 +646,7 @@ int CGitIgnoreItem::FetchIgnoreList(CString &file) p=buffer+i+1; } } + /* Can't free buffer, exluced list will use this buffer*/ //delete buffer; //buffer=NULL; } @@ -894,17 +895,18 @@ int CGitIgnoreList::CheckIgnore(CString &path,CString &projectroot) temp=temp.Left(x); temp+=_T("\\.gitignore"); + + char *base; + + patha.Replace('\\', '/'); + int pos=patha.ReverseFind('/'); + base = pos>=0? patha.GetBuffer()+pos+1:patha.GetBuffer(); + if(this->m_Map.find(temp) == m_Map.end() ) { }else { - char *base; - - patha.Replace('\\', '/'); - int pos=patha.ReverseFind('/'); - base = pos>=0? patha.GetBuffer()+pos+1:patha.GetBuffer(); - int ret=-1; if(m_Map[temp].m_pExcludeList) @@ -927,7 +929,7 @@ int CGitIgnoreList::CheckIgnore(CString &path,CString &projectroot) int ret=-1; if(m_Map[temp].m_pExcludeList) - git_check_excluded_1( patha, patha.GetLength(), NULL,&type, m_Map[temp].m_pExcludeList); + git_check_excluded_1( patha, patha.GetLength(), base, &type, m_Map[temp].m_pExcludeList); if(ret == 1) return 1; -- 2.11.4.GIT