Commit 53454be8 by Carlos Martín Nieto Committed by GitHub

Merge pull request #4157 from adamniedzielski/4099-git-sort-time-uninteresting

Skip uninteresting commits in revwalk timesort iterator
parents 0b3623ac c11c08a5
......@@ -231,10 +231,13 @@ static int revwalk_next_timesort(git_commit_list_node **object_out, git_revwalk
{
git_commit_list_node *next;
if ((next = git_pqueue_pop(&walk->iterator_time)) != NULL) {
while ((next = git_pqueue_pop(&walk->iterator_time)) != NULL) {
/* Some commits might become uninteresting after being added to the list */
if (!next->uninteresting) {
*object_out = next;
return 0;
}
}
giterr_clear();
return GIT_ITEROVER;
......
......@@ -345,6 +345,26 @@ void test_revwalk_basic__topo_crash(void)
git_revwalk_next(&oid, _walk);
}
void test_revwalk_basic__from_new_to_old(void)
{
git_oid from_oid, to_oid, oid;
int i = 0;
revwalk_basic_setup_walk(NULL);
git_revwalk_sorting(_walk, GIT_SORT_TIME);
cl_git_pass(git_oid_fromstr(&to_oid, "5b5b025afb0b4c913b4c338a42934a3863bf3644"));
cl_git_pass(git_oid_fromstr(&from_oid, "a4a7dce85cf63874e984719f4fdd239f5145052f"));
cl_git_pass(git_revwalk_push(_walk, &to_oid));
cl_git_pass(git_revwalk_hide(_walk, &from_oid));
while (git_revwalk_next(&oid, _walk) == 0)
i++;
cl_assert_equal_i(i, 0);
}
void test_revwalk_basic__push_range(void)
{
revwalk_basic_setup_walk(NULL);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment