2005-05-23 17:52:17 +00:00
|
|
|
#include "cache.h"
|
2006-05-23 12:15:34 +00:00
|
|
|
#include "builtin.h"
|
2008-12-27 23:03:57 +00:00
|
|
|
#include "parse-options.h"
|
2016-08-08 21:02:59 +00:00
|
|
|
#include "apply.h"
|
2016-05-11 13:16:19 +00:00
|
|
|
|
2008-12-27 23:03:57 +00:00
|
|
|
static const char * const apply_usage[] = {
|
2015-01-13 07:44:47 +00:00
|
|
|
N_("git apply [<options>] [<patch>...]"),
|
2008-12-27 23:03:57 +00:00
|
|
|
NULL
|
|
|
|
};
|
2005-05-23 17:52:17 +00:00
|
|
|
|
2016-05-24 08:11:24 +00:00
|
|
|
int cmd_apply(int argc, const char **argv, const char *prefix)
|
|
|
|
{
|
2008-12-27 23:03:57 +00:00
|
|
|
int force_apply = 0;
|
2016-05-11 13:16:17 +00:00
|
|
|
int options = 0;
|
2016-05-24 08:11:24 +00:00
|
|
|
int ret;
|
2016-05-11 13:16:19 +00:00
|
|
|
struct apply_state state;
|
2005-05-23 17:52:17 +00:00
|
|
|
|
2018-08-13 16:14:39 +00:00
|
|
|
if (init_apply_state(&state, the_repository, prefix))
|
2016-08-08 21:03:08 +00:00
|
|
|
exit(128);
|
2007-02-17 20:37:25 +00:00
|
|
|
|
2016-09-04 20:18:30 +00:00
|
|
|
argc = apply_parse_options(argc, argv,
|
|
|
|
&state, &force_apply, &options,
|
|
|
|
apply_usage);
|
2009-05-23 18:53:11 +00:00
|
|
|
|
2016-08-08 21:03:09 +00:00
|
|
|
if (check_apply_state(&state, force_apply))
|
|
|
|
exit(128);
|
2015-01-29 23:35:24 +00:00
|
|
|
|
2016-05-24 08:11:24 +00:00
|
|
|
ret = apply_all_patches(&state, argc, argv, options);
|
2005-05-23 17:52:17 +00:00
|
|
|
|
2016-05-24 08:10:46 +00:00
|
|
|
clear_apply_state(&state);
|
2005-11-26 07:14:15 +00:00
|
|
|
|
2016-05-24 08:11:24 +00:00
|
|
|
return ret;
|
2005-05-23 17:52:17 +00:00
|
|
|
}
|