MCPcopy Index your code
hub / github.com/git/git / create_ce_entry

Function create_ce_entry

unpack-trees.c:1066–1095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1064}
1065
1066static 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

Callers 2

unpack_single_entryFunction · 0.85
unpack_sparse_callbackFunction · 0.85

Calls 8

traverse_path_lenFunction · 0.85
tree_entry_lenFunction · 0.85
make_empty_cache_entryFunction · 0.85
create_ce_modeFunction · 0.85
create_ce_flagsFunction · 0.85
oidcpyFunction · 0.85
make_traverse_pathFunction · 0.85

Tested by

no test coverage detected