Commit c11c08a5 by Adam Niedzielski

Skip uninteresting commits in revwalk timesort iterator

Fixes #4099
parent b31b2360
...@@ -231,9 +231,12 @@ static int revwalk_next_timesort(git_commit_list_node **object_out, git_revwalk ...@@ -231,9 +231,12 @@ static int revwalk_next_timesort(git_commit_list_node **object_out, git_revwalk
{ {
git_commit_list_node *next; git_commit_list_node *next;
if ((next = git_pqueue_pop(&walk->iterator_time)) != NULL) { while ((next = git_pqueue_pop(&walk->iterator_time)) != NULL) {
*object_out = next; /* Some commits might become uninteresting after being added to the list */
return 0; if (!next->uninteresting) {
*object_out = next;
return 0;
}
} }
giterr_clear(); giterr_clear();
......
...@@ -345,6 +345,26 @@ void test_revwalk_basic__topo_crash(void) ...@@ -345,6 +345,26 @@ void test_revwalk_basic__topo_crash(void)
git_revwalk_next(&oid, _walk); 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) void test_revwalk_basic__push_range(void)
{ {
revwalk_basic_setup_walk(NULL); 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