| 1064 | } |
| 1065 | |
| 1066 | static struct cache_entry *create_ce_entry(const struct traverse_info *info, |
| 1067 | const struct name_entry *n, |
| 1068 | int stage, |
| 1069 | struct index_state *istate, |
| 1070 | int is_transient, |
| 1071 | int is_sparse_directory) |
| 1072 | { |
| 1073 | size_t len = traverse_path_len(info, tree_entry_len(n)); |
| 1074 | size_t alloc_len = is_sparse_directory ? len + 1 : len; |
| 1075 | struct cache_entry *ce = |
| 1076 | is_transient ? |
| 1077 | make_empty_transient_cache_entry(alloc_len, NULL) : |
| 1078 | make_empty_cache_entry(istate, alloc_len); |
| 1079 | |
| 1080 | ce->ce_mode = create_ce_mode(n->mode); |
| 1081 | ce->ce_flags = create_ce_flags(stage); |
| 1082 | ce->ce_namelen = len; |
| 1083 | oidcpy(&ce->oid, &n->oid); |
| 1084 | /* len+1 because the cache_entry allocates space for NUL */ |
| 1085 | make_traverse_path(ce->name, len + 1, info, n->path, n->pathlen); |
| 1086 | |
| 1087 | if (is_sparse_directory) { |
| 1088 | ce->name[len] = '/'; |
| 1089 | ce->name[len + 1] = '\0'; |
| 1090 | ce->ce_namelen++; |
| 1091 | ce->ce_flags |= CE_SKIP_WORKTREE; |
| 1092 | } |
| 1093 | |
| 1094 | return ce; |
| 1095 | } |
| 1096 | |
| 1097 | /* |
| 1098 | * Determine whether the path specified by 'p' should be unpacked as a new |
no test coverage detected