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

Function add_pbase_object

builtin/pack-objects.c:2026–2065  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2024}
2025
2026static void add_pbase_object(struct tree_desc *tree,
2027 const char *name,
2028 size_t cmplen,
2029 const char *fullname)
2030{
2031 struct name_entry entry;
2032 int cmp;
2033
2034 while (tree_entry(tree,&entry)) {
2035 if (S_ISGITLINK(entry.mode))
2036 continue;
2037 cmp = tree_entry_len(&entry) != cmplen ? 1 :
2038 memcmp(name, entry.path, cmplen);
2039 if (cmp > 0)
2040 continue;
2041 if (cmp < 0)
2042 return;
2043 if (name[cmplen] != '/') {
2044 add_object_entry(&entry.oid,
2045 object_type(entry.mode),
2046 fullname, 1);
2047 return;
2048 }
2049 if (S_ISDIR(entry.mode)) {
2050 struct tree_desc sub;
2051 struct pbase_tree_cache *tree;
2052 const char *down = name+cmplen+1;
2053 size_t downlen = name_cmp_len(down);
2054
2055 tree = pbase_tree_get(&entry.oid);
2056 if (!tree)
2057 return;
2058 init_tree_desc(&sub, &tree->oid,
2059 tree->tree_data, tree->tree_size);
2060
2061 add_pbase_object(&sub, down, downlen, fullname);
2062 pbase_tree_put(tree);
2063 }
2064 }
2065}
2066
2067static unsigned *done_pbase_paths;
2068static int done_pbase_paths_num;

Callers 1

Calls 8

tree_entry_lenFunction · 0.85
add_object_entryFunction · 0.85
name_cmp_lenFunction · 0.85
pbase_tree_getFunction · 0.85
init_tree_descFunction · 0.85
pbase_tree_putFunction · 0.85
tree_entryClass · 0.70
object_typeEnum · 0.70

Tested by

no test coverage detected