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

Function add_recent_object

reachable.c:203–244  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

201}
202
203static int add_recent_object(const struct object_id *oid,
204 struct object_info *oi,
205 void *cb_data)
206{
207 struct recent_data *data = cb_data;
208 struct object *obj;
209
210 if (!want_recent_object(data, oid) ||
211 !obj_is_recent(oid, *oi->mtimep, data))
212 return 0;
213
214 switch (*oi->typep) {
215 case OBJ_TAG:
216 case OBJ_COMMIT:
217 obj = parse_object_or_die(the_repository, oid, NULL);
218 break;
219 case OBJ_TREE:
220 obj = (struct object *)lookup_tree(the_repository, oid);
221 break;
222 case OBJ_BLOB:
223 obj = (struct object *)lookup_blob(the_repository, oid);
224 break;
225 default:
226 die("unknown object type for %s: %s",
227 oid_to_hex(oid), type_name(*oi->typep));
228 }
229
230 if (!obj)
231 die("unable to lookup %s", oid_to_hex(oid));
232 if (obj->flags & SEEN)
233 return 0;
234
235 add_pending_object(data->revs, obj, "");
236 if (data->cb) {
237 if (oi->whence == OI_PACKED)
238 data->cb(obj, oi->u.packed.pack, oi->u.packed.offset, *oi->mtimep);
239 else
240 data->cb(obj, NULL, 0, *oi->mtimep);
241 }
242
243 return 0;
244}
245
246int add_unseen_recent_objects_to_traversal(struct rev_info *revs,
247 timestamp_t timestamp,

Callers

nothing calls this directly

Calls 9

want_recent_objectFunction · 0.85
obj_is_recentFunction · 0.85
parse_object_or_dieFunction · 0.85
lookup_treeFunction · 0.85
lookup_blobFunction · 0.85
oid_to_hexFunction · 0.85
type_nameFunction · 0.85
add_pending_objectFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected