1#include "cache.h"
   2#include "builtin.h"
   3#include "parse-options.h"
   4#include "lockfile.h"
   5#include "apply.h"
   6static const char * const apply_usage[] = {
   8        N_("git apply [<options>] [<patch>...]"),
   9        NULL
  10};
  11static struct lock_file lock_file;
  13int cmd_apply(int argc, const char **argv, const char *prefix)
  15{
  16        int force_apply = 0;
  17        int options = 0;
  18        int ret;
  19        struct apply_state state;
  20        if (init_apply_state(&state, prefix, &lock_file))
  22                exit(128);
  23        argc = apply_parse_options(argc, argv,
  25                                   &state, &force_apply, &options,
  26                                   apply_usage);
  27        if (check_apply_state(&state, force_apply))
  29                exit(128);
  30        ret = apply_all_patches(&state, argc, argv, options);
  32        clear_apply_state(&state);
  34        return ret;
  36}