本文整理汇总了C++中CGitAdminDirMap::GetAdminDirConcat方法的典型用法代码示例。如果您正苦于以下问题:C++ CGitAdminDirMap::GetAdminDirConcat方法的具体用法?C++ CGitAdminDirMap::GetAdminDirConcat怎么用?C++ CGitAdminDirMap::GetAdminDirConcat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGitAdminDirMap
的用法示例。
在下文中一共展示了CGitAdminDirMap::GetAdminDirConcat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Check
int CGitIndexFileMap::Check(const CString &gitdir, bool *isChanged)
{
__int64 time;
CString IndexFile = g_AdminDirMap.GetAdminDirConcat(gitdir, _T("index"));
if (CGit::GetFileModifyTime(IndexFile, &time))
return -1;
SHARED_INDEX_PTR pIndex;
pIndex = this->SafeGet(gitdir);
if (!pIndex)
{
if(isChanged)
*isChanged = true;
return 0;
}
if (pIndex->m_LastModifyTime == time)
{
if (isChanged)
*isChanged = false;
}
else
{
if (isChanged)
*isChanged = true;
}
return 0;
}
示例2: IsExistIndexLockFile
bool GitStatus::IsExistIndexLockFile(CString sDirName)
{
if (!PathIsDirectory(sDirName))
{
int x = sDirName.ReverseFind(_T('\\'));
if (x < 2)
return false;
sDirName = sDirName.Left(x);
}
for (;;)
{
if (PathFileExists(CombinePath(sDirName, _T(".git"))))
{
if (PathFileExists(g_AdminDirMap.GetAdminDirConcat(sDirName, _T("index.lock"))))
return true;
return false;
}
int x = sDirName.ReverseFind(_T('\\'));
if (x < 2)
return false;
sDirName = sDirName.Left(x);
}
}
示例3: GetPackRef
// This method is assumed to be called with m_SharedMutex locked.
int CGitHeadFileList::GetPackRef(const CString &gitdir)
{
CString PackRef = g_AdminDirMap.GetAdminDirConcat(gitdir, _T("packed-refs"));
__int64 mtime;
if (CGit::GetFileModifyTime(PackRef, &mtime))
{
//packed refs is not existed
this->m_PackRefFile.Empty();
this->m_PackRefMap.clear();
return 0;
}
else if(mtime == m_LastModifyTimePackRef)
return 0;
else
{
this->m_PackRefFile = PackRef;
this->m_LastModifyTimePackRef = mtime;
}
m_PackRefMap.clear();
CAutoFile hfile = CreateFile(PackRef,
GENERIC_READ,
FILE_SHARE_READ | FILE_SHARE_DELETE | FILE_SHARE_WRITE,
nullptr,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,
nullptr);
if (!hfile)
return -1;
DWORD filesize = GetFileSize(hfile, nullptr);
if (filesize == 0)
return -1;
DWORD size = 0;
auto buff = std::make_unique<char[]>(filesize);
ReadFile(hfile, buff.get(), filesize, &size, nullptr);
if (size != filesize)
return -1;
for (DWORD i = 0; i < filesize;)
{
CString hash;
CString ref;
if (buff[i] == '#' || buff[i] == '^')
{
while (buff[i] != '\n')
{
++i;
if (i == filesize)
break;
}
++i;
}
if (i >= filesize)
break;
while (buff[i] != ' ')
{
hash.AppendChar(buff[i]);
++i;
if (i == filesize)
break;
}
++i;
if (i >= filesize)
break;
while (buff[i] != '\n')
{
ref.AppendChar(buff[i]);
++i;
if (i == filesize)
break;
}
if (!ref.IsEmpty())
m_PackRefMap[ref] = hash;
while (buff[i] == '\n')
{
++i;
if (i == filesize)
break;
}
}
return 0;
}