| 3354 | } |
| 3355 | |
| 3356 | static int apply_fragments(struct apply_state *state, struct image *img, struct patch *patch) |
| 3357 | { |
| 3358 | struct fragment *frag = patch->fragments; |
| 3359 | const char *name = patch->old_name ? patch->old_name : patch->new_name; |
| 3360 | unsigned ws_rule = patch->ws_rule; |
| 3361 | unsigned inaccurate_eof = patch->inaccurate_eof; |
| 3362 | int nth = 0; |
| 3363 | |
| 3364 | if (patch->is_binary) |
| 3365 | return apply_binary(state, img, patch); |
| 3366 | |
| 3367 | while (frag) { |
| 3368 | nth++; |
| 3369 | if (apply_one_fragment(state, img, frag, inaccurate_eof, ws_rule, nth)) { |
| 3370 | error(_("patch failed: %s:%ld"), name, frag->oldpos); |
| 3371 | if (!state->apply_with_reject) |
| 3372 | return -1; |
| 3373 | frag->rejected = 1; |
| 3374 | } |
| 3375 | frag = frag->next; |
| 3376 | } |
| 3377 | return 0; |
| 3378 | } |
| 3379 | |
| 3380 | static int read_blob_object(struct strbuf *buf, const struct object_id *oid, unsigned mode) |
| 3381 | { |
no test coverage detected