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

Function process_refs

builtin/fsck.c:675–714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

673}
674
675static void process_refs(struct repository *repo, struct snapshot *snap)
676{
677 struct worktree **worktrees, **p;
678
679 for (size_t i = 0; i < snap->nr; i++) {
680 struct reference ref = {
681 .name = snap->ref[i].refname,
682 .oid = &snap->ref[i].oid,
683 };
684 fsck_handle_ref(&ref, repo);
685 }
686
687 if (include_reflogs) {
688 worktrees = get_worktrees();
689 for (p = worktrees; *p; p++) {
690 struct worktree *wt = *p;
691
692 refs_for_each_reflog(get_worktree_ref_store(wt),
693 fsck_handle_reflog, wt);
694 }
695 free_worktrees(worktrees);
696 }
697
698 /*
699 * Not having any default heads isn't really fatal, but
700 * it does mean that "--unreachable" no longer makes any
701 * sense (since in this case everything will obviously
702 * be unreachable by definition.
703 *
704 * Showing dangling objects is valid, though (as those
705 * dangling objects are likely lost heads).
706 *
707 * So we just print a warning about it, and clear the
708 * "show_unreachable" flag.
709 */
710 if (!default_refs) {
711 fprintf_ln(stderr, _("notice: No default references"));
712 show_unreachable = 0;
713 }
714}
715
716struct for_each_loose_cb {
717 struct repository *repo;

Callers 1

cmd_fsckFunction · 0.85

Calls 6

fsck_handle_refFunction · 0.85
get_worktreesFunction · 0.85
refs_for_each_reflogFunction · 0.85
get_worktree_ref_storeFunction · 0.85
free_worktreesFunction · 0.85
fprintf_lnFunction · 0.85

Tested by

no test coverage detected