Ejemplo n.º 1
0
int CGitIndexFileMap::IsUnderVersionControl(const CString &gitdir, const CString &path, bool isDir,bool *isVersion, bool isLoadUpdateIndex)
{
	try
	{
		if (path.IsEmpty())
		{
			*isVersion = true;
			return 0;
		}

		CString subpath = path;
		subpath.Replace(_T('\\'), _T('/'));
		if(isDir)
			subpath += _T('/');

		subpath.MakeLower();

		CheckAndUpdate(gitdir, isLoadUpdateIndex);

		SHARED_INDEX_PTR pIndex = this->SafeGet(gitdir);

		if(pIndex.get())
		{
			if(isDir)
				*isVersion = (SearchInSortVector(*pIndex, subpath.GetBuffer(), subpath.GetLength()) >= 0);
			else
				*isVersion = (SearchInSortVector(*pIndex, subpath.GetBuffer(), -1) >= 0);
		}

	}catch(...)
	{
		return -1;
	}
	return 0;
}
Ejemplo n.º 2
0
int CGitIndexFileMap::GetFileStatus(const CString &gitdir, const CString &path, git_wc_status_kind *status,BOOL IsFull, BOOL IsRecursive,
                                    FILL_STATUS_CALLBACK callback, void *pData,
                                    CGitHash *pHash,
                                    bool isLoadUpdatedIndex, bool * assumeValid, bool * skipWorktree)
{
    try
    {
        CheckAndUpdate(gitdir, isLoadUpdatedIndex);

        SHARED_INDEX_PTR pIndex = this->SafeGet(gitdir);
        if (pIndex.get() != NULL)
        {
            pIndex->GetStatus(gitdir, path, status, IsFull, IsRecursive, callback, pData, pHash, assumeValid, skipWorktree);
        }
        else
        {
            // git working tree has not index
            *status = git_wc_status_unversioned;
        }
    }
    catch(...)
    {
        return -1;
    }
    return 0;
}
Ejemplo n.º 3
0
int CGitIndexFileMap::GetFileStatus(const CString &gitdir, const CString &path, git_wc_status_kind *status,BOOL IsFull, BOOL IsRecursive,
									FIll_STATUS_CALLBACK callback,void *pData,
									CGitHash *pHash,
									bool isLoadUpdatedIndex)
{
	try
	{
		CheckAndUpdate(gitdir, isLoadUpdatedIndex);

		SHARED_INDEX_PTR pIndex = this->SafeGet(gitdir);
		if (pIndex.get() != NULL)
		{
			pIndex->GetStatus(gitdir, path, status, IsFull, IsRecursive, callback, pData, pHash);
		}

	}
	catch(...)
	{
		return -1;
	}
	return 0;
}