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