MCPcopy Index your code
hub / github.com/git/git / revert_from_diff

Function revert_from_diff

add-interactive.c:679–700  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

677}
678
679static 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
702static int run_revert(struct add_i_state *s, const struct pathspec *ps,
703 struct prefix_item_list *files,

Callers

nothing calls this directly

Calls 5

is_null_oidFunction · 0.85
remove_file_from_indexFunction · 0.85
make_cache_entryFunction · 0.85
add_index_entryFunction · 0.85
dieFunction · 0.70

Tested by

no test coverage detected