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

Function reftable_be_optimize

refs/reftable-backend.c:1656–1687  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1654}
1655
1656static int reftable_be_optimize(struct ref_store *ref_store,
1657 struct refs_optimize_opts *opts)
1658{
1659 struct reftable_ref_store *refs =
1660 reftable_be_downcast(ref_store, REF_STORE_WRITE | REF_STORE_ODB, "optimize_refs");
1661 struct reftable_stack *stack;
1662 int ret;
1663
1664 if (refs->err)
1665 return refs->err;
1666
1667 stack = refs->worktree_backend.stack;
1668 if (!stack)
1669 stack = refs->main_backend.stack;
1670
1671 if (opts->flags & REFS_OPTIMIZE_AUTO)
1672 ret = reftable_stack_auto_compact(stack);
1673 else
1674 ret = reftable_stack_compact_all(stack, NULL);
1675 if (ret < 0) {
1676 ret = error(_("unable to compact stack: %s"),
1677 reftable_error_str(ret));
1678 goto out;
1679 }
1680
1681 ret = reftable_stack_clean(stack);
1682 if (ret)
1683 goto out;
1684
1685out:
1686 return ret;
1687}
1688
1689static int reftable_be_optimize_required(struct ref_store *ref_store,
1690 struct refs_optimize_opts *opts,

Callers

nothing calls this directly

Calls 6

reftable_be_downcastFunction · 0.85
errorFunction · 0.85
reftable_error_strFunction · 0.85
reftable_stack_cleanFunction · 0.85

Tested by

no test coverage detected