+ do {
+ struct commit *commit = revs->commits->item;
+
+ revs->commits = revs->commits->next;
+
+ /*
+ * If we haven't done the list limiting, we need to look at
+ * the parents here. We also need to do the date-based limiting
+ * that we'd otherwise have done in limit_list().
+ */
+ if (!revs->limited) {
+ if ((revs->unpacked &&
+ has_sha1_pack(commit->object.sha1)) ||
+ (revs->max_age != -1 &&
+ (commit->date < revs->max_age)))
+ continue;
+ add_parents_to_list(revs, commit, &revs->commits);
+ }
+ if (commit->object.flags & SHOWN)
+ continue;
+ if (!(commit->object.flags & BOUNDARY) &&
+ (commit->object.flags & UNINTERESTING))
+ continue;
+ if (revs->min_age != -1 && (commit->date > revs->min_age))
+ continue;
+ if (revs->no_merges &&
+ commit->parents && commit->parents->next)
+ continue;
+ if (revs->prune_fn && revs->dense) {
+ if (!(commit->object.flags & TREECHANGE))
+ continue;
+ if (revs->parents)
+ rewrite_parents(commit);
+ }
+ commit->object.flags |= SHOWN;
+ return commit;
+ } while (revs->commits);
+ return NULL;
+}