]> git.ipfire.org Git - thirdparty/git.git/blame - builtin/apply.c
Seventh batch for 2.12
[thirdparty/git.git] / builtin / apply.c
CommitLineData
c1bb9350 1#include "cache.h"
ac6245e3 2#include "builtin.h"
f26c4940 3#include "parse-options.h"
13b5af22 4#include "lockfile.h"
71501a71 5#include "apply.h"
2fc0f184 6
f26c4940 7static const char * const apply_usage[] = {
9c9b4f2f 8 N_("git apply [<options>] [<patch>...]"),
f26c4940
MV
9 NULL
10};
c1bb9350 11
021b6e45 12static struct lock_file lock_file;
5aa7d94c 13
91b769c4
CC
14int cmd_apply(int argc, const char **argv, const char *prefix)
15{
f26c4940 16 int force_apply = 0;
d1b27ced 17 int options = 0;
91b769c4 18 int ret;
2fc0f184 19 struct apply_state state;
c1bb9350 20
2f5a6d12
CC
21 if (init_apply_state(&state, prefix, &lock_file))
22 exit(128);
67160271 23
7e1bad24
CC
24 argc = apply_parse_options(argc, argv,
25 &state, &force_apply, &options,
26 apply_usage);
4c8d4c14 27
f36538d8
CC
28 if (check_apply_state(&state, force_apply))
29 exit(128);
c536c075 30
91b769c4 31 ret = apply_all_patches(&state, argc, argv, options);
c1bb9350 32
6f27b941 33 clear_apply_state(&state);
edf2e370 34
91b769c4 35 return ret;
c1bb9350 36}