MCPcopy Create free account
hub / github.com/git/git / mark_reachable

Function mark_reachable

reflog.c:303–335  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

301 * us again to restart the traversal with longer expire_limit.
302 */
303static 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
337static int is_unreachable(struct expire_reflog_policy_cb *cb, struct commit *commit, struct object_id *oid)
338{

Callers 2

is_unreachableFunction · 0.85
reflog_expiry_prepareFunction · 0.85

Calls 3

pop_commitFunction · 0.85
repo_parse_commitFunction · 0.85
commit_list_insertFunction · 0.85

Tested by

no test coverage detected