Merge branch 'jc/push-default-explicit' into maint
[gitweb.git] / apply.h
diff --git a/apply.h b/apply.h
index e18a18a96438bff6990e574cb9c31fc6a5a42d4e..b3d6783d55344de5aaa3d4b81a22abed0b6972fb 100644 (file)
--- a/apply.h
+++ b/apply.h
@@ -13,6 +13,12 @@ enum apply_ws_ignore {
        ignore_ws_change
 };
 
+enum apply_verbosity {
+       verbosity_silent = -1,
+       verbosity_normal = 0,
+       verbosity_verbose = 1
+};
+
 /*
  * We need to keep track of how symlinks in the preimage are
  * manipulated by the patches.  A patch to add a/b/c where a/b
@@ -51,13 +57,14 @@ struct apply_state {
        int allow_overlap;
        int apply_in_reverse;
        int apply_with_reject;
-       int apply_verbosely;
        int no_add;
        int threeway;
        int unidiff_zero;
        int unsafe_paths;
 
        /* Other non boolean parameters */
+       const char *index_file;
+       enum apply_verbosity apply_verbosity;
        const char *fake_ancestor;
        const char *patch_input_file;
        int line_termination;
@@ -88,6 +95,14 @@ struct apply_state {
         */
        struct string_list fn_table;
 
+       /*
+        * This is to save reporting routines before using
+        * set_error_routine() or set_warn_routine() to install muting
+        * routines when in verbosity_silent mode.
+        */
+       void (*saved_error_routine)(const char *err, va_list params);
+       void (*saved_warn_routine)(const char *warn, va_list params);
+
        /* These control whitespace errors */
        enum apply_ws_error_action ws_error_action;
        enum apply_ws_ignore ws_ignore_action;
@@ -97,14 +112,26 @@ struct apply_state {
        int applied_after_fixing_ws;
 };
 
-extern int parse_whitespace_option(struct apply_state *state,
-                                  const char *option);
-extern int parse_ignorewhitespace_option(struct apply_state *state,
-                                        const char *option);
-
+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);
 extern void clear_apply_state(struct apply_state *state);
+extern int check_apply_state(struct apply_state *state, int force_apply);
+
+/*
+ * Some aspects of the apply behavior are controlled by the following
+ * bits in the "options" parameter passed to apply_all_patches().
+ */
+#define APPLY_OPT_INACCURATE_EOF       (1<<0) /* accept inaccurate eof */
+#define APPLY_OPT_RECOUNT              (1<<1) /* accept inaccurate line count */
+
+extern int apply_all_patches(struct apply_state *state,
+                            int argc,
+                            const char **argv,
+                            int options);
 
 #endif