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

Function tree_is_complete

reflog.c:140–182  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

138#define REACHABLE (1u<<12)
139
140static int tree_is_complete(const struct object_id *oid)
141{
142 struct tree_desc desc;
143 struct name_entry entry;
144 int complete;
145 struct tree *tree;
146
147 tree = lookup_tree(the_repository, oid);
148 if (!tree)
149 return 0;
150 if (tree->object.flags & SEEN)
151 return 1;
152 if (tree->object.flags & INCOMPLETE)
153 return 0;
154
155 if (!tree->buffer) {
156 enum object_type type;
157 size_t size;
158 void *data = odb_read_object(the_repository->objects, oid,
159 &type, &size);
160 if (!data) {
161 tree->object.flags |= INCOMPLETE;
162 return 0;
163 }
164 tree->buffer = data;
165 tree->size = size;
166 }
167 init_tree_desc(&desc, &tree->object.oid, tree->buffer, tree->size);
168 complete = 1;
169 while (tree_entry(&desc, &entry)) {
170 if (!odb_has_object(the_repository->objects, &entry.oid,
171 ODB_HAS_OBJECT_RECHECK_PACKED | ODB_HAS_OBJECT_FETCH_PROMISOR) ||
172 (S_ISDIR(entry.mode) && !tree_is_complete(&entry.oid))) {
173 tree->object.flags |= INCOMPLETE;
174 complete = 0;
175 }
176 }
177 free_tree_buffer(tree);
178
179 if (complete)
180 tree->object.flags |= SEEN;
181 return complete;
182}
183
184static int commit_is_complete(struct commit *commit)
185{

Callers 1

commit_is_completeFunction · 0.85

Calls 6

lookup_treeFunction · 0.85
odb_read_objectFunction · 0.85
init_tree_descFunction · 0.85
odb_has_objectFunction · 0.85
free_tree_bufferFunction · 0.85
tree_entryFunction · 0.70

Tested by

no test coverage detected