phase zero is to remove, phase one is to create */
| 4689 | |
| 4690 | /* phase zero is to remove, phase one is to create */ |
| 4691 | static int write_out_one_result(struct apply_state *state, |
| 4692 | struct patch *patch, |
| 4693 | int phase) |
| 4694 | { |
| 4695 | if (patch->is_delete > 0) { |
| 4696 | if (phase == 0) |
| 4697 | return remove_file(state, patch, 1); |
| 4698 | return 0; |
| 4699 | } |
| 4700 | if (patch->is_new > 0 || patch->is_copy) { |
| 4701 | if (phase == 1) |
| 4702 | return create_file(state, patch); |
| 4703 | return 0; |
| 4704 | } |
| 4705 | /* |
| 4706 | * Rename or modification boils down to the same |
| 4707 | * thing: remove the old, write the new |
| 4708 | */ |
| 4709 | if (phase == 0) |
| 4710 | return remove_file(state, patch, patch->is_rename); |
| 4711 | if (phase == 1) |
| 4712 | return create_file(state, patch); |
| 4713 | return 0; |
| 4714 | } |
| 4715 | |
| 4716 | static int write_out_one_reject(struct apply_state *state, struct patch *patch) |
| 4717 | { |
no test coverage detected