gitlab-ci: introduce stages and dependencies
[git/gitster.git] / builtin / apply.c
blob84f1863d3ac3490bebbb746c61a2d695de09c848
1 #define USE_THE_REPOSITORY_VARIABLE
2 #include "builtin.h"
3 #include "gettext.h"
4 #include "hash.h"
5 #include "apply.h"
7 static const char * const apply_usage[] = {
8 N_("git apply [<options>] [<patch>...]"),
9 NULL
12 int cmd_apply(int argc,
13 const char **argv,
14 const char *prefix,
15 struct repository *repo UNUSED)
17 int force_apply = 0;
18 int options = 0;
19 int ret;
20 struct apply_state state;
22 if (init_apply_state(&state, the_repository, prefix))
23 exit(128);
26 * We could to redo the "apply.c" machinery to make this
27 * arbitrary fallback unnecessary, but it is dubious that it
28 * is worth the effort.
29 * cf. https://lore.kernel.org/git/xmqqcypfcmn4.fsf@gitster.g/
31 if (!the_hash_algo)
32 repo_set_hash_algo(the_repository, GIT_HASH_SHA1);
34 argc = apply_parse_options(argc, argv,
35 &state, &force_apply, &options,
36 apply_usage);
38 if (check_apply_state(&state, force_apply))
39 exit(128);
41 ret = apply_all_patches(&state, argc, argv, options);
43 clear_apply_state(&state);
45 return ret;