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

Function compare_entry

unpack-trees.c:1028–1049  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1026}
1027
1028static int compare_entry(const struct cache_entry *ce, const struct traverse_info *info, const struct name_entry *n)
1029{
1030 int cmp = do_compare_entry(ce, info, n->path, n->pathlen, n->mode);
1031 if (cmp)
1032 return cmp;
1033
1034 /*
1035 * At this point, we know that we have a prefix match. If ce
1036 * is a sparse directory, then allow an exact match. This only
1037 * works when the input name is a directory, since ce->name
1038 * ends in a directory separator.
1039 */
1040 if (S_ISSPARSEDIR(ce->ce_mode) &&
1041 ce->ce_namelen == traverse_path_len(info, tree_entry_len(n)) + 1)
1042 return 0;
1043
1044 /*
1045 * Even if the beginning compared identically, the ce should
1046 * compare as bigger than a directory leading up to it!
1047 */
1048 return ce_namelen(ce) > traverse_path_len(info, tree_entry_len(n));
1049}
1050
1051static int ce_in_traverse_path(const struct cache_entry *ce,
1052 const struct traverse_info *info)

Callers 1

unpack_callbackFunction · 0.85

Calls 3

do_compare_entryFunction · 0.85
traverse_path_lenFunction · 0.85
tree_entry_lenFunction · 0.85

Tested by

no test coverage detected