// apr_hash_t * statushash;\r
// apr_pool_t * pool;\r
//git_error_t * err = NULL; // If svn_client_status comes out through catch(...), err would else be unassigned\r
- BOOL err = FALSE;\r
+ git_error_t err = 0;\r
\r
//dont' build the cache if an instance of TortoiseProc is running\r
//since this could interfere with svn commands running (concurrent\r
// rev.kind = git_opt_revision_unspecified;\r
try\r
{\r
- // extract the sub-path (relative to project root)\r
-//MessageBox(NULL, filepath.GetDirectory().GetWinPathString(), sProjectRoot, MB_OK);\r
-// LPCSTR lpszSubPath = NULL;\r
- CString sSubPath;\r
- CString s = filepath.GetWinPathString();\r
- if (s.GetLength() > sProjectRoot.GetLength())\r
+ if (g_ShellCache.GetCacheType() == ShellCache::dll)\r
{\r
- sSubPath = s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/);\r
-// lpszSubPath = sSubPath;\r
+ // gitindex.h based status\r
+\r
+ // extract the sub-path (relative to project root)\r
+ CString sSubPath;\r
+ CString s = filepath.GetWinPathString();\r
+ if (s.GetLength() > sProjectRoot.GetLength())\r
+ {\r
+ sSubPath = s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/);\r
+ }\r
+\r
+ git_wc_status_kind status;\r
+\r
+ err = g_IndexFileMap.GetFileStatus((CString&)sProjectRoot,sSubPath,&status,true,true,fillstatusmap_idx,this);\r
}\r
+ else\r
+ {\r
+ // extract the sub-path (relative to project root)\r
+//MessageBox(NULL, filepath.GetDirectory().GetWinPathString(), sProjectRoot, MB_OK);\r
+ LPCSTR lpszSubPath = NULL;\r
+ CStringA sSubPath;\r
+ CString s = filepath.GetDirectory().GetWinPathString();\r
+ if (s.GetLength() > sProjectRoot.GetLength())\r
+ {\r
+ sSubPath = CStringA(s.Right(s.GetLength() - sProjectRoot.GetLength() - 1/*otherwise it gets initial slash*/));\r
+ lpszSubPath = sSubPath;\r
+ }\r
\r
//if (lpszSubPath) MessageBoxA(NULL, lpszSubPath, "BuildCache", MB_OK);\r
//MessageBoxA(NULL, CStringA(sProjectRoot), sSubPath, MB_OK);\r
- //err = !wgEnumFiles_safe(CStringA(sProjectRoot), lpszSubPath, WGEFF_NoRecurse|WGEFF_FullPath|WGEFF_DirStatusAll, &fillstatusmap, this);\r
- //CTGitPath path;\r
- //path.SetFromWin(sSubPath);\r
- git_wc_status_kind status;\r
-\r
- err = g_IndexFileMap.GetFileStatus((CString&)sProjectRoot,sSubPath,&status,true,true,fillstatusmap,this);\r
- \r
- //err = g_IndexFileMap.GetFileStatus(sProjectRoot,&path,\r
- /*err = svn_client_status4 (&youngest,\r
- filepath.GetDirectory().GetSVNApiPath(pool),\r
- &rev,\r
- fillstatusmap,\r
- this,\r
- svn_depth_immediates, //depth\r
- TRUE, //getall\r
- FALSE, //update\r
- TRUE, //noignore\r
- FALSE, //ignore externals\r
- NULL,\r
- localctx,\r
- pool);*/\r
+ err = !wgEnumFiles(CStringA(sProjectRoot), lpszSubPath, WGEFF_NoRecurse|WGEFF_FullPath|WGEFF_DirStatusAll, &fillstatusmap, this);\r
+\r
+ /*err = svn_client_status4 (&youngest,\r
+ filepath.GetDirectory().GetSVNApiPath(pool),\r
+ &rev,\r
+ fillstatusmap,\r
+ this,\r
+ svn_depth_immediates, //depth\r
+ TRUE, //getall\r
+ FALSE, //update\r
+ TRUE, //noignore\r
+ FALSE, //ignore externals\r
+ NULL,\r
+ localctx,\r
+ pool);*/\r
+ }\r
}\r
catch ( ... )\r
{\r
return NULL;\r
}\r
\r
-void GitFolderStatus::fillstatusmap(CString &path,git_wc_status_kind status,void *pUserData)\r
+BOOL GitFolderStatus::fillstatusmap(const struct wgFile_s *pFile, void *pUserData)\r
+{\r
+ GitFolderStatus *Stat = (GitFolderStatus*)pUserData;\r
+\r
+ FileStatusMap &cache = Stat->m_cache;\r
+ FileStatusCacheEntry s;\r
+ s.needslock = false;\r
+ s.tree_conflict = false;\r
+\r
+ s.author = Stat->authors.GetString(NULL);\r
+ s.url = Stat->urls.GetString(NULL);\r
+ if (pFile->sha1)\r
+ s.rev = ConvertHashToRevnum(pFile->sha1);\r
+ s.owner = Stat->owners.GetString(NULL);\r
+\r
+ s.status = git_wc_status_none;\r
+\r
+ //s.status = GitStatus::GetMoreImportant(s.status, status->text_status);\r
+ //s.status = GitStatus::GetMoreImportant(s.status, status->prop_status);\r
+ s.status = GitStatusFromWingit(pFile->nStatus);\r
+\r
+ // TODO ?: s.blaha = pFile->nStage\r
+\r
+ //s.lock = status->repos_lock;\r
+ //s.tree_conflict = (status->tree_conflict != NULL);\r
+\r
+ s.askedcounter = GITFOLDERSTATUS_CACHETIMES;\r
+ stdstring str;\r
+ if (pFile->sFileName)\r
+ {\r
+ str = CUnicodeUtils::StdGetUnicode(pFile->sFileName);\r
+ std::replace(str.begin(), str.end(), '/', '\\');\r
+//MessageBox(NULL, str.c_str(), _T(""), MB_OK);\r
+ }\r
+ else\r
+ str = _T(" ");\r
+ cache[str] = s;\r
+\r
+ return FALSE;\r
+}\r
+\r
+void GitFolderStatus::fillstatusmap_idx(CString &path,git_wc_status_kind status,void *pUserData)\r
{\r
GitFolderStatus *Stat = (GitFolderStatus*)pUserData;\r
\r