Fix revision walk for commits with the same dates

Logic in still_interesting function allows to stop the commits traversing if the oldest processed commit is not older then the youngest commit on the list to process and the list contains only commits marked as not interesting ones. It can be premature when dealing with a set of coequal commits. For example git rev-list A^! --not B provides wrong answer if all commits in the range A..B had the same commit time and there are more then 7 of them. To fix this problem the relevant part of the logic in still_interesting is changed to: the walk can be stopped if the oldest processed commit is younger then the youngest commit on the list to processed. Signed-off-by: Kacper Kornet <draenog@pld-linux.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Kacper Kornet committed Mar 22, 2013 at 19:38 UTC c19d1b4e840535c5fc27077194e8ac219c02644c
2 files changed +14 -1
revision.c
+1 -1
@@ -708,7 +708,7 @@ static int still_interesting(struct commit_list *src, unsigned long date, int sl
708 * Does the destination list contain entries with a date
709 * before the source list? Definitely _not_ done.
710 */
711 - if (date < src->item->date)
711 + if (date <= src->item->date)
712 return SLOP;
713
714 /*
t/t6009-rev-list-parent.sh
+13
@@ -133,4 +133,17 @@ test_expect_success 'dodecapus' '
133 check_revlist "--min-parents=13" &&
134 check_revlist "--min-parents=4 --max-parents=11" tetrapus
135 '
136 +
137 +test_expect_success 'ancestors with the same commit time' '
138 +
139 + test_tick_keep=$test_tick &&
140 + for i in 1 2 3 4 5 6 7 8; do
141 + test_tick=$test_tick_keep
142 + test_commit t$i
143 + done &&
144 + git rev-list t1^! --not t$i >result &&
145 + >expect &&
146 + test_cmp expect result
147 +'
148 +
149 test_done