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

Function handle_commit

revision.c:381–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

379}
380
381static struct commit *handle_commit(struct rev_info *revs,
382 struct object_array_entry *entry)
383{
384 struct object *object = entry->item;
385 const char *name = entry->name;
386 const char *path = entry->path;
387 unsigned int mode = entry->mode;
388 unsigned long flags = object->flags;
389
390 /*
391 * Tag object? Look what it points to..
392 */
393 while (object->type == OBJ_TAG) {
394 struct tag *tag = (struct tag *) object;
395 struct object_id *oid;
396 if (revs->tag_objects && !(flags & UNINTERESTING))
397 add_pending_object(revs, object, tag->tag);
398 oid = get_tagged_oid(tag);
399 object = parse_object(revs->repo, oid);
400 if (!object) {
401 if (revs->ignore_missing_links || (flags & UNINTERESTING))
402 return NULL;
403 if (revs->exclude_promisor_objects &&
404 is_promisor_object(revs->repo, &tag->tagged->oid))
405 return NULL;
406 if (revs->do_not_die_on_missing_objects && oid) {
407 oidset_insert(&revs->missing_commits, oid);
408 return NULL;
409 }
410 die("bad object %s", oid_to_hex(&tag->tagged->oid));
411 }
412 object->flags |= flags;
413 /*
414 * We'll handle the tagged object by looping or dropping
415 * through to the non-tag handlers below. Do not
416 * propagate path data from the tag's pending entry.
417 */
418 path = NULL;
419 mode = 0;
420 }
421
422 /*
423 * Commit object? Just return it, we'll do all the complex
424 * reachability crud.
425 */
426 if (object->type == OBJ_COMMIT) {
427 struct commit *commit = (struct commit *)object;
428
429 if (repo_parse_commit(revs->repo, commit) < 0)
430 die("unable to parse commit %s", name);
431 if (flags & UNINTERESTING) {
432 mark_parents_uninteresting(revs, commit);
433
434 if (!revs->topo_order || !generation_numbers_enabled(the_repository))
435 revs->limited = 1;
436 }
437 if (revs->sources) {
438 char **slot = revision_sources_at(revs->sources, commit);

Callers 1

prepare_revision_walkFunction · 0.70

Calls 13

add_pending_objectFunction · 0.85
get_tagged_oidFunction · 0.85
parse_objectFunction · 0.85
is_promisor_objectFunction · 0.85
oidset_insertFunction · 0.85
oid_to_hexFunction · 0.85
repo_parse_commitFunction · 0.85
xstrdupFunction · 0.85

Tested by

no test coverage detected