Beispiel #1
0
int CGitHeadFileMap::GetHeadHash(const CString &gitdir, CGitHash &hash)
{
	SHARED_TREE_PTR ptr;
	ptr = this->SafeGet(gitdir);

	if(ptr.get() == NULL)
	{
		SHARED_TREE_PTR ptr1(new CGitHeadFileList());
		ptr1->ReadHeadHash(gitdir);

		hash = ptr1->m_Head;

		this->SafeSet(gitdir, ptr1);

	}
	else
	{
		if(ptr->CheckHeadUpdate())
		{
			SHARED_TREE_PTR ptr1(new CGitHeadFileList());
			ptr1->ReadHeadHash(gitdir);

			hash = ptr1->m_Head;
			this->SafeSet(gitdir, ptr1);
	}

		hash = ptr->m_Head;
	}
	return 0;
}
bool CGitHeadFileMap::CheckHeadAndUpdate(const CString &gitdir, bool readTree /* = true */)
{
	SHARED_TREE_PTR ptr = this->SafeGet(gitdir, true);

	if (ptr.get() && !ptr->CheckHeadUpdate() && (!readTree || ptr->HeadHashEqualsTreeHash()))
		return false;

	ptr = SHARED_TREE_PTR(new CGitHeadFileList);
	ptr->ReadHeadHash(gitdir);
	if (readTree)
		ptr->ReadTree();

	this->SafeSet(gitdir, ptr);

	return true;
}
Beispiel #3
0
bool CGitHeadFileMap::CheckHeadUpdate(const CString &gitdir)
{
	SHARED_TREE_PTR ptr;
	ptr = this->SafeGet(gitdir);

	if( ptr.get())
	{
		return ptr->CheckHeadUpdate();
	}
	else
	{
		SHARED_TREE_PTR ptr1(new CGitHeadFileList);
		ptr1->ReadHeadHash(gitdir);

		this->SafeSet(gitdir, ptr1);
		return true;
	}
	return false;
}