* Given an origin, prepare mmfile_t structure to be used by the * diff machinery */
| 1029 | * diff machinery |
| 1030 | */ |
| 1031 | static void fill_origin_blob(struct diff_options *opt, |
| 1032 | struct blame_origin *o, mmfile_t *file, |
| 1033 | int *num_read_blob, int fill_fingerprints) |
| 1034 | { |
| 1035 | if (!o->file.ptr) { |
| 1036 | enum object_type type; |
| 1037 | unsigned long file_size; |
| 1038 | |
| 1039 | (*num_read_blob)++; |
| 1040 | if (opt->flags.allow_textconv && |
| 1041 | textconv_object(opt->repo, o->path, o->mode, |
| 1042 | &o->blob_oid, 1, &file->ptr, &file_size)) |
| 1043 | ; |
| 1044 | else { |
| 1045 | size_t file_size_st = 0; |
| 1046 | file->ptr = odb_read_object(the_repository->objects, |
| 1047 | &o->blob_oid, &type, |
| 1048 | &file_size_st); |
| 1049 | file_size = cast_size_t_to_ulong(file_size_st); |
| 1050 | } |
| 1051 | file->size = file_size; |
| 1052 | |
| 1053 | if (!file->ptr) |
| 1054 | die("Cannot read blob %s for path %s", |
| 1055 | oid_to_hex(&o->blob_oid), |
| 1056 | o->path); |
| 1057 | o->file = *file; |
| 1058 | } |
| 1059 | else |
| 1060 | *file = o->file; |
| 1061 | if (fill_fingerprints) |
| 1062 | fill_origin_fingerprints(o); |
| 1063 | } |
| 1064 | |
| 1065 | static void drop_origin_blob(struct blame_origin *o) |
| 1066 | { |
no test coverage detected