Beispiel #1
0
static void mark_uninteresting(commit_object *commit)
{
	unsigned short i;
	assert(commit);

	commit->uninteresting = 1;

	for (i = 0; i < commit->out_degree; ++i)
		if (!commit->parents[i]->uninteresting)
			mark_uninteresting(commit->parents[i]);
}
Beispiel #2
0
int git_revwalk_hide(git_revwalk *walk, git_commit *commit)
{
	git_revwalk_commit *hide;

	assert(walk && commit);
	
	hide = insert_commit(walk, commit);
	if (hide == NULL)
		return GIT_ENOMEM;

	mark_uninteresting(hide);
	return GIT_SUCCESS;
}
Beispiel #3
0
static void mark_uninteresting(git_revwalk_commit *commit)
{
	git_revwalk_listnode *parent;

	assert(commit);

	commit->uninteresting = 1;
	parent = commit->parents.head;

	while (parent) {
		mark_uninteresting(parent->walk_commit);
		parent = parent->next;
	}
}
Beispiel #4
0
static int process_commit(git_revwalk *walk, commit_object *commit)
{
	int error;

	if (commit->seen)
		return GIT_SUCCESS;

	commit->seen = 1;

	if ((error = commit_parse(walk, commit)) < GIT_SUCCESS)
			return error;

	if (commit->uninteresting)
		mark_uninteresting(commit);

	return walk->enqueue(walk, commit);
}
Beispiel #5
0
static int process_commit(git_revwalk *walk, git_commit_list_node *commit, int hide)
{
	int error;

	if (!hide && walk->hide_cb)
		hide = walk->hide_cb(&commit->oid, walk->hide_cb_payload);

	if (hide && mark_uninteresting(walk, commit) < 0)
		return -1;

	if (commit->seen)
		return 0;

	commit->seen = 1;

	if ((error = git_commit_list_parse(walk, commit)) < 0)
		return error;

	if (!hide)
		return walk->enqueue(walk, commit);

	return 0;
}