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

Function find_subtree

cache-tree.c:80–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80static struct cache_tree_sub *find_subtree(struct cache_tree *it,
81 const char *path,
82 int pathlen,
83 int create)
84{
85 struct cache_tree_sub *down;
86 int pos = cache_tree_subtree_pos(it, path, pathlen);
87 if (0 <= pos)
88 return it->down[pos];
89 if (!create)
90 return NULL;
91
92 pos = -pos-1;
93 ALLOC_GROW(it->down, it->subtree_nr + 1, it->subtree_alloc);
94 it->subtree_nr++;
95
96 FLEX_ALLOC_MEM(down, name, path, pathlen);
97 down->cache_tree = NULL;
98 down->namelen = pathlen;
99
100 if (pos < it->subtree_nr)
101 MOVE_ARRAY(it->down + pos + 1, it->down + pos,
102 it->subtree_nr - pos - 1);
103 it->down[pos] = down;
104 return down;
105}
106
107struct cache_tree_sub *cache_tree_sub(struct cache_tree *it, const char *path)
108{

Callers 5

cache_tree_subFunction · 0.85
do_invalidate_pathFunction · 0.85
update_oneFunction · 0.85
cache_tree_findFunction · 0.85
verify_oneFunction · 0.85

Calls 1

cache_tree_subtree_posFunction · 0.85

Tested by

no test coverage detected