Merge branch 'master' of github.com:alshopov/git-po
[alt-git.git] / builtin / apply.c
blob555219de40fa7e3097612a60eb953f81580a8de9
1 #include "cache.h"
2 #include "builtin.h"
3 #include "parse-options.h"
4 #include "apply.h"
6 static const char * const apply_usage[] = {
7 N_("git apply [<options>] [<patch>...]"),
8 NULL
9 };
11 int cmd_apply(int argc, const char **argv, const char *prefix)
13 int force_apply = 0;
14 int options = 0;
15 int ret;
16 struct apply_state state;
18 if (init_apply_state(&state, the_repository, prefix))
19 exit(128);
21 argc = apply_parse_options(argc, argv,
22 &state, &force_apply, &options,
23 apply_usage);
25 if (check_apply_state(&state, force_apply))
26 exit(128);
28 ret = apply_all_patches(&state, argc, argv, options);
30 clear_apply_state(&state);
32 return ret;