本文整理汇总了C++中CGit::GetGitRepository方法的典型用法代码示例。如果您正苦于以下问题:C++ CGit::GetGitRepository方法的具体用法?C++ CGit::GetGitRepository怎么用?C++ CGit::GetGitRepository使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CGit
的用法示例。
在下文中一共展示了CGit::GetGitRepository方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FillBasedOnIndexFlags
int CTGitPathList::FillBasedOnIndexFlags(unsigned short flag, CTGitPathList* list /*nullptr*/)
{
Clear();
CTGitPath path;
CAutoRepository repository(g_Git.GetGitRepository());
if (!repository)
return -1;
CAutoIndex index;
if (git_repository_index(index.GetPointer(), repository))
return -1;
int count;
if (list == nullptr)
count = 1;
else
count = list->GetCount();
for (int j = 0; j < count; ++j)
{
for (size_t i = 0, ecount = git_index_entrycount(index); i < ecount; ++i)
{
const git_index_entry *e = git_index_get_byindex(index, i);
if (!e || !((e->flags | e->flags_extended) & flag) || !e->path)
continue;
CString one = CUnicodeUtils::GetUnicode(e->path);
if (!(!list || (*list)[j].GetWinPathString().IsEmpty() || one == (*list)[j].GetGitPathString() || (PathIsDirectory(g_Git.CombinePath((*list)[j].GetWinPathString())) && one.Find((*list)[j].GetGitPathString() + _T("/")) == 0)))
continue;
//SetFromGit will clear all status
path.SetFromGit(one);
if ((e->flags | e->flags_extended) & GIT_IDXENTRY_SKIP_WORKTREE)
path.m_Action = CTGitPath::LOGACTIONS_SKIPWORKTREE;
else if ((e->flags | e->flags_extended) & GIT_IDXENTRY_VALID)
path.m_Action = CTGitPath::LOGACTIONS_ASSUMEVALID;
AddPath(path);
}
}
RemoveDuplicates();
return 0;
}