| 1026 | } |
| 1027 | |
| 1028 | static 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 | |
| 1051 | static int ce_in_traverse_path(const struct cache_entry *ce, |
| 1052 | const struct traverse_info *info) |
no test coverage detected