]>
Commit | Line | Data |
---|---|---|
ac6245e3 | 1 | #include "builtin.h" |
f394e093 | 2 | #include "gettext.h" |
d1cbe1e6 | 3 | #include "repository.h" |
71501a71 | 4 | #include "apply.h" |
2fc0f184 | 5 | |
f26c4940 | 6 | static const char * const apply_usage[] = { |
9c9b4f2f | 7 | N_("git apply [<options>] [<patch>...]"), |
f26c4940 MV |
8 | NULL |
9 | }; | |
c1bb9350 | 10 | |
91b769c4 CC |
11 | int cmd_apply(int argc, const char **argv, const char *prefix) |
12 | { | |
f26c4940 | 13 | int force_apply = 0; |
d1b27ced | 14 | int options = 0; |
91b769c4 | 15 | int ret; |
2fc0f184 | 16 | struct apply_state state; |
c1bb9350 | 17 | |
82ea77ec | 18 | if (init_apply_state(&state, the_repository, prefix)) |
2f5a6d12 | 19 | exit(128); |
67160271 | 20 | |
7e1bad24 CC |
21 | argc = apply_parse_options(argc, argv, |
22 | &state, &force_apply, &options, | |
23 | apply_usage); | |
4c8d4c14 | 24 | |
f36538d8 CC |
25 | if (check_apply_state(&state, force_apply)) |
26 | exit(128); | |
c536c075 | 27 | |
91b769c4 | 28 | ret = apply_all_patches(&state, argc, argv, options); |
c1bb9350 | 29 | |
6f27b941 | 30 | clear_apply_state(&state); |
edf2e370 | 31 | |
91b769c4 | 32 | return ret; |
c1bb9350 | 33 | } |