path: root/apply.h
diff options
authorChristian Couder <>2016-09-04 20:18:30 (GMT)
committerJunio C Hamano <>2016-09-07 19:29:53 (GMT)
commit7e1bad24e3b7f220813d8a449f19652113edb923 (patch)
treea30fc0cebdaa9a0276bb3d22986233b4f499ea4c /apply.h
parent45b78d8ba3c9e542f1375171090fe10baef6b2b2 (diff)
apply: refactor `git apply` option parsing
Parsing `git apply` options can be useful to other commands that want to call the libified apply functionality, because this way they can easily pass some options from their own command line to the libified apply functionality. This will be used by `git am` in a following patch. To make this possible, let's refactor the `git apply` option parsing code into a new libified apply_parse_options() function. Doing that makes it possible to remove some functions definitions from "apply.h" and make them static in "apply.c". Helped-by: Ramsay Jones <> Signed-off-by: Christian Couder <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'apply.h')
1 files changed, 4 insertions, 14 deletions
diff --git a/apply.h b/apply.h
index 902346b..9fec536 100644
--- a/apply.h
+++ b/apply.h
@@ -111,20 +111,10 @@ struct apply_state {
int applied_after_fixing_ws;
-extern int apply_option_parse_exclude(const struct option *opt,
- const char *arg, int unset);
-extern int apply_option_parse_include(const struct option *opt,
- const char *arg, int unset);
-extern int apply_option_parse_p(const struct option *opt,
- const char *arg,
- int unset);
-extern int apply_option_parse_whitespace(const struct option *opt,
- const char *arg, int unset);
-extern int apply_option_parse_directory(const struct option *opt,
- const char *arg, int unset);
-extern int apply_option_parse_space_change(const struct option *opt,
- const char *arg, int unset);
+extern int apply_parse_options(int argc, const char **argv,
+ struct apply_state *state,
+ int *force_apply, int *options,
+ const char * const *apply_usage);
extern int init_apply_state(struct apply_state *state,
const char *prefix,
struct lock_file *lock_file);