* Starting from commits in the cb->mark_list, mark commits that are * reachable from them. Stop the traversal at commits older than * the expire_limit and queue them back, so that the caller can call * us again to restart the traversal with longer expire_limit. */
| 301 | * us again to restart the traversal with longer expire_limit. |
| 302 | */ |
| 303 | static void mark_reachable(struct expire_reflog_policy_cb *cb) |
| 304 | { |
| 305 | struct commit_list *pending; |
| 306 | timestamp_t expire_limit = cb->mark_limit; |
| 307 | struct commit_list *leftover = NULL; |
| 308 | |
| 309 | for (pending = cb->mark_list; pending; pending = pending->next) |
| 310 | pending->item->object.flags &= ~REACHABLE; |
| 311 | |
| 312 | pending = cb->mark_list; |
| 313 | while (pending) { |
| 314 | struct commit_list *parent; |
| 315 | struct commit *commit = pop_commit(&pending); |
| 316 | if (commit->object.flags & REACHABLE) |
| 317 | continue; |
| 318 | if (repo_parse_commit(the_repository, commit)) |
| 319 | continue; |
| 320 | commit->object.flags |= REACHABLE; |
| 321 | if (commit->date < expire_limit) { |
| 322 | commit_list_insert(commit, &leftover); |
| 323 | continue; |
| 324 | } |
| 325 | parent = commit->parents; |
| 326 | while (parent) { |
| 327 | commit = parent->item; |
| 328 | parent = parent->next; |
| 329 | if (commit->object.flags & REACHABLE) |
| 330 | continue; |
| 331 | commit_list_insert(commit, &pending); |
| 332 | } |
| 333 | } |
| 334 | cb->mark_list = leftover; |
| 335 | } |
| 336 | |
| 337 | static int is_unreachable(struct expire_reflog_policy_cb *cb, struct commit *commit, struct object_id *oid) |
| 338 | { |
no test coverage detected