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

Function batch_object_write

builtin/cat-file.c:481–573  ·  view source on GitHub ↗

* If "pack" is non-NULL, then "offset" is the byte offset within the pack from * which the object may be accessed (though note that we may also rely on * data->oid, too). If "pack" is NULL, then offset is ignored. */

Source from the content-addressed store, hash-verified

479 * data->oid, too). If "pack" is NULL, then offset is ignored.
480 */
481static void batch_object_write(const char *obj_name,
482 struct strbuf *scratch,
483 struct batch_options *opt,
484 struct expand_data *data,
485 struct packed_git *pack,
486 off_t offset)
487{
488 if (!data->skip_object_info) {
489 int ret;
490
491 if (use_mailmap ||
492 opt->objects_filter.choice == LOFC_BLOB_NONE ||
493 opt->objects_filter.choice == LOFC_BLOB_LIMIT ||
494 opt->objects_filter.choice == LOFC_OBJECT_TYPE)
495 data->info.typep = &data->type;
496 if (opt->objects_filter.choice == LOFC_BLOB_LIMIT)
497 data->info.sizep = &data->size;
498
499 if (pack)
500 ret = packed_object_info(pack, offset, &data->info);
501 else
502 ret = odb_read_object_info_extended(the_repository->objects,
503 &data->oid, &data->info,
504 OBJECT_INFO_LOOKUP_REPLACE);
505 if (ret < 0) {
506 if (data->mode == S_IFGITLINK)
507 report_object_status(opt, NULL, &data->oid, "submodule");
508 else
509 report_object_status(opt, obj_name, &data->oid, "missing");
510 return;
511 }
512
513 switch (opt->objects_filter.choice) {
514 case LOFC_DISABLED:
515 break;
516 case LOFC_BLOB_NONE:
517 if (data->type == OBJ_BLOB) {
518 if (!opt->all_objects)
519 report_object_status(opt, obj_name,
520 &data->oid, "excluded");
521 return;
522 }
523 break;
524 case LOFC_BLOB_LIMIT:
525 if (data->type == OBJ_BLOB &&
526 data->size >= opt->objects_filter.blob_limit_value) {
527 if (!opt->all_objects)
528 report_object_status(opt, obj_name,
529 &data->oid, "excluded");
530 return;
531 }
532 break;
533 case LOFC_OBJECT_TYPE:
534 if (data->type != opt->objects_filter.object_type) {
535 if (!opt->all_objects)
536 report_object_status(opt, obj_name,
537 &data->oid, "excluded");
538 return;

Callers 3

batch_one_objectFunction · 0.85
batch_object_cbFunction · 0.85
batch_unordered_objectFunction · 0.85

Calls 12

packed_object_infoFunction · 0.85
report_object_statusFunction · 0.85
odb_read_objectFunction · 0.85
oid_to_hexFunction · 0.85
print_default_formatFunction · 0.85
expand_formatFunction · 0.85
strbuf_addchFunction · 0.85
batch_writeFunction · 0.85
print_object_or_dieFunction · 0.85
dieFunction · 0.50

Tested by

no test coverage detected