#include "PreserveChdir.h"\r
#include "UnicodeUtils.h"\r
#include "GitStatus.h"\r
-//#include "..\TSVNCache\CacheInterface.h"\r
+#include "..\TGitCache\CacheInterface.h"\r
\r
// "The Shell calls IShellIconOverlayIdentifier::GetOverlayInfo to request the\r
// location of the handler's icon overlay. The icon overlay handler returns\r
}\r
return S_FALSE;\r
}\r
-#if 0\r
+\r
switch (g_ShellCache.GetCacheType())\r
{\r
case ShellCache::exe:\r
{\r
-#if 0\r
TSVNCacheResponse itemStatus;\r
SecureZeroMemory(&itemStatus, sizeof(itemStatus));\r
- if (m_remoteCacheLink.GetStatusFromRemoteCache(CTSVNPath(pPath), &itemStatus, true))\r
+ if (m_remoteCacheLink.GetStatusFromRemoteCache(CTGitPath(pPath), &itemStatus, true))\r
{\r
- status = SVNStatus::GetMoreImportant(itemStatus.m_status.text_status, itemStatus.m_status.prop_status);\r
- if ((itemStatus.m_kind == git_node_file)&&(status == git_wc_status_normal)&&((itemStatus.m_needslock && itemStatus.m_owner[0]==0)||(itemStatus.m_readonly)))\r
+ status = GitStatus::GetMoreImportant(itemStatus.m_status.text_status, itemStatus.m_status.prop_status);\r
+/* if ((itemStatus.m_kind == git_node_file)&&(status == git_wc_status_normal)&&((itemStatus.m_needslock && itemStatus.m_owner[0]==0)||(itemStatus.m_readonly)))\r
readonlyoverlay = true;\r
if (itemStatus.m_owner[0]!=0)\r
- lockedoverlay = true;\r
+ lockedoverlay = true;*/\r
}\r
-#endif \r
}\r
-// break;\r
+ break;\r
case ShellCache::dll:\r
+ case ShellCache::dllFull:\r
{\r
// Look in our caches for this item \r
-#if 0\r
- const FileStatusCacheEntry * s = m_CachedStatus.GetCachedItem(CTSVNPath(pPath));\r
+ const FileStatusCacheEntry * s = m_CachedStatus.GetCachedItem(CTGitPath(pPath));\r
if (s)\r
{\r
status = s->status;\r
}\r
else\r
{\r
- const FileStatusCacheEntry * s = m_CachedStatus.GetFullStatus(CTSVNPath(pPath), TRUE);\r
+ const FileStatusCacheEntry * s = m_CachedStatus.GetFullStatus(CTGitPath(pPath), TRUE);\r
status = s->status;\r
- status = SVNStatus::GetMoreImportant(git_wc_status_normal, status);\r
+ // GitFolderStatus does not list unversioned files/dir so they would always end up as normal below\r
+ // so let's assume file/dir is unversioned if not found in cache\r
+ /*// sub-dirs that are empty (or contain no versioned files) are reported as unversioned (and should be kept as such)\r
+ if (status != git_wc_status_unversioned)\r
+ {\r
+ // if get status fails then display status as 'normal' on folder (since it contains .git)\r
+ // TODO: works for svn since each folder has .svn, not sure if git needs additinoal processing\r
+ status = GitStatus::GetMoreImportant(git_wc_status_normal, status);\r
+ }*/\r
}\r
}\r
else\r
}\r
else\r
{\r
- const FileStatusCacheEntry * s = m_CachedStatus.GetFullStatus(CTSVNPath(pPath), FALSE);\r
+ const FileStatusCacheEntry * s = m_CachedStatus.GetFullStatus(CTGitPath(pPath), FALSE);\r
status = s->status;\r
}\r
}\r
readonlyoverlay = true;\r
if ((s)&&(s->owner[0]!=0))\r
lockedoverlay = true;\r
-#endif\r
}\r
\r
+ // index based version does not enumerate unversioned files, so default to unversioned\r
+ if (g_ShellCache.GetCacheType() == ShellCache::dll\r
+ && status == git_wc_status_none && g_ShellCache.HasSVNAdminDir(pPath, true))\r
+ status = git_wc_status_unversioned;\r
break;\r
default:\r
case ShellCache::none:\r
break;\r
}\r
ATLTRACE(_T("Status %d for file %s\n"), status, pwszPath);\r
-#endif \r
- }\r
-\r
- if (PathIsDirectory(pPath))\r
- {\r
- if (g_ShellCache.HasSVNAdminDir(pPath, TRUE))\r
- {\r
- status = git_wc_status_normal; \r
- }else\r
- {\r
- status = git_wc_status_none;\r
- }\r
}\r
g_filepath.clear();\r
g_filepath = pPath;\r
g_filestatus = status;\r
g_readonlyoverlay = readonlyoverlay;\r
g_lockedoverlay = lockedoverlay;\r
- \r
+\r
//the priority system of the shell doesn't seem to work as expected (or as I expected):\r
//as it seems that if one handler returns S_OK then that handler is used, no matter\r
//if other handlers would return S_OK too (they're never called on my machine!)\r
//So we return S_OK for ONLY ONE handler!\r
+\r
switch (status)\r
{\r
// note: we can show other overlays if due to lack of enough free overlay\r
}\r
case git_wc_status_replaced:\r
case git_wc_status_modified:\r
- case git_wc_status_merged:\r
if (m_State == FileStateModified)\r
{\r
g_filepath.clear();\r
}\r
else\r
return S_FALSE;\r
+ case git_wc_status_merged:\r
+ if (m_State == FileStateReadOnly)\r
+ {\r
+ g_filepath.clear();\r
+ return S_OK;\r
+ }\r
+ else\r
+ return S_FALSE;\r
case git_wc_status_added:\r
if (g_addedovlloaded)\r
{\r