| 677 | } |
| 678 | |
| 679 | static void revert_from_diff(struct diff_queue_struct *q, |
| 680 | struct diff_options *opt, void *data UNUSED) |
| 681 | { |
| 682 | int i, add_flags = ADD_CACHE_OK_TO_ADD | ADD_CACHE_OK_TO_REPLACE; |
| 683 | |
| 684 | for (i = 0; i < q->nr; i++) { |
| 685 | struct diff_filespec *one = q->queue[i]->one; |
| 686 | struct cache_entry *ce; |
| 687 | |
| 688 | if (!(one->mode && !is_null_oid(&one->oid))) { |
| 689 | remove_file_from_index(opt->repo->index, one->path); |
| 690 | printf(_("note: %s is untracked now.\n"), one->path); |
| 691 | } else { |
| 692 | ce = make_cache_entry(opt->repo->index, one->mode, |
| 693 | &one->oid, one->path, 0, 0); |
| 694 | if (!ce) |
| 695 | die(_("make_cache_entry failed for path '%s'"), |
| 696 | one->path); |
| 697 | add_index_entry(opt->repo->index, ce, add_flags); |
| 698 | } |
| 699 | } |
| 700 | } |
| 701 | |
| 702 | static int run_revert(struct add_i_state *s, const struct pathspec *ps, |
| 703 | struct prefix_item_list *files, |
nothing calls this directly
no test coverage detected