| 4669 | } |
| 4670 | |
| 4671 | static int create_file(struct apply_state *state, struct patch *patch) |
| 4672 | { |
| 4673 | char *path = patch->new_name; |
| 4674 | unsigned mode = patch->new_mode; |
| 4675 | unsigned long size = patch->resultsize; |
| 4676 | char *buf = patch->result; |
| 4677 | |
| 4678 | if (!mode) |
| 4679 | mode = S_IFREG | 0644; |
| 4680 | if (create_one_file(state, path, mode, buf, size)) |
| 4681 | return -1; |
| 4682 | |
| 4683 | if (patch->conflicted_threeway) |
| 4684 | return add_conflicted_stages_file(state, patch); |
| 4685 | else if (state->check_index || (state->ita_only && patch->is_new > 0)) |
| 4686 | return add_index_file(state, path, mode, buf, size); |
| 4687 | return 0; |
| 4688 | } |
| 4689 | |
| 4690 | /* phase zero is to remove, phase one is to create */ |
| 4691 | static int write_out_one_result(struct apply_state *state, |
no test coverage detected