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

Function write_index_as_tree_internal

cache-tree.c:700–725  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

698}
699
700static int write_index_as_tree_internal(struct object_id *oid,
701 struct index_state *index_state,
702 int cache_tree_valid,
703 int flags,
704 const char *prefix)
705{
706 if (flags & WRITE_TREE_IGNORE_CACHE_TREE) {
707 cache_tree_free(&index_state->cache_tree);
708 cache_tree_valid = 0;
709 }
710
711 if (!cache_tree_valid && cache_tree_update(index_state, flags) < 0)
712 return WRITE_TREE_UNMERGED_INDEX;
713
714 if (prefix) {
715 struct cache_tree *subtree;
716 subtree = cache_tree_find(index_state->cache_tree, prefix);
717 if (!subtree)
718 return WRITE_TREE_PREFIX_ERROR;
719 oidcpy(oid, &subtree->oid);
720 }
721 else
722 oidcpy(oid, &index_state->cache_tree->oid);
723
724 return 0;
725}
726
727struct tree *write_in_core_index_as_tree(struct repository *repo,
728 struct index_state *index_state) {

Callers 2

write_index_as_treeFunction · 0.85

Calls 4

cache_tree_freeFunction · 0.85
cache_tree_updateFunction · 0.85
cache_tree_findFunction · 0.85
oidcpyFunction · 0.85

Tested by

no test coverage detected