int CGitIgnoreList::LoadAllIgnoreFile(const CString &gitdir,const CString &path) { CString temp; temp = gitdir; temp += _T("\\"); temp += path; temp.Replace(_T('/'), _T('\\')); while (!temp.IsEmpty()) { temp += _T("\\.git"); if (CGit::GitPathFileExists(temp)) { CString gitignore = temp; gitignore += _T("ignore"); if (CheckFileChanged(gitignore)) { FetchIgnoreFile(gitdir, gitignore); } temp += _T("\\info\\exclude"); if (CheckFileChanged(temp)) { return FetchIgnoreFile(gitdir, temp); } return 0; } else { temp += _T("ignore"); if (CheckFileChanged(temp)) { FetchIgnoreFile(gitdir, temp); } } int found = 0; int i; for (i = temp.GetLength() - 1; i >= 0; i--) { if(temp[i] == _T('\\')) found ++; if(found == 2) break; } temp = temp.Left(i); } return 0; }
int CGitIgnoreList::LoadAllIgnoreFile(const CString &gitdir, const CString &path, bool isDir) { CString temp(gitdir); temp += _T('\\'); temp += path; temp.Replace(_T('/'), _T('\\')); if (!isDir) { int x = temp.ReverseFind(_T('\\')); if (x >= 2) temp.Truncate(x); } while (!temp.IsEmpty()) { CString tempOrig = temp; temp += _T("\\.git"); if (CGit::GitPathFileExists(temp)) { CString gitignore = temp; gitignore += _T("ignore"); if (CheckFileChanged(gitignore)) FetchIgnoreFile(gitdir, gitignore, false); CString adminDir = g_AdminDirMap.GetAdminDir(tempOrig); CString wcglobalgitignore = adminDir; wcglobalgitignore += _T("info\\exclude"); if (CheckFileChanged(wcglobalgitignore)) { FetchIgnoreFile(gitdir, wcglobalgitignore, true); } if (CheckAndUpdateCoreExcludefile(adminDir)) { CString excludesFile; { CAutoReadLock lock(m_SharedMutex); excludesFile = m_CoreExcludesfiles[adminDir]; } if (!excludesFile.IsEmpty()) FetchIgnoreFile(gitdir, excludesFile, true); } return 0; } temp += _T("ignore"); if (CheckFileChanged(temp)) FetchIgnoreFile(gitdir, temp, false); int found = 0; int i; for (i = temp.GetLength() - 1; i >= 0; --i) { if(temp[i] == _T('\\')) ++found; if(found == 2) break; } temp.Truncate(i); } return 0; }
int CGitIgnoreList::LoadAllIgnoreFile(const CString &gitdir,const CString &path) { CString temp; temp = gitdir; temp += _T("\\"); temp += path; temp.Replace(_T('/'), _T('\\')); while (!temp.IsEmpty()) { CString tempOrig = temp; temp += _T("\\.git"); if (CGit::GitPathFileExists(temp)) { CString gitignore = temp; gitignore += _T("ignore"); if (CheckFileChanged(gitignore)) { FetchIgnoreFile(gitdir, gitignore, false); } CString adminDir = g_AdminDirMap.GetAdminDir(tempOrig); CString wcglobalgitignore = adminDir + _T("info\\exclude"); if (CheckFileChanged(wcglobalgitignore)) { FetchIgnoreFile(gitdir, wcglobalgitignore, true); } if (CheckAndUpdateCoreExcludefile(adminDir)) { m_SharedMutex.AcquireShared(); CString excludesFile = m_CoreExcludesfiles[adminDir]; m_SharedMutex.ReleaseShared(); if (!excludesFile.IsEmpty()) FetchIgnoreFile(gitdir, excludesFile, true); } return 0; } else { temp += _T("ignore"); if (CheckFileChanged(temp)) { FetchIgnoreFile(gitdir, temp, false); } } int found = 0; int i; for (i = temp.GetLength() - 1; i >= 0; i--) { if(temp[i] == _T('\\')) ++found; if(found == 2) break; } temp = temp.Left(i); } return 0; }