6 enum apply_ws_error_action
{
13 enum apply_ws_ignore
{
18 enum apply_verbosity
{
19 verbosity_silent
= -1,
25 * We need to keep track of how symlinks in the preimage are
26 * manipulated by the patches. A patch to add a/b/c where a/b
27 * is a symlink should not be allowed to affect the directory
28 * the symlink points at, but if the same patch removes a/b,
29 * it is perfectly fine, as the patch removes a/b to make room
30 * to create a directory a/b so that a/b/c can be created.
32 * See also "struct string_list symlink_changes" in "struct
35 #define APPLY_SYMLINK_GOES_AWAY 01
36 #define APPLY_SYMLINK_IN_RESULT 02
42 struct lock_file lock_file
;
44 /* These control what gets looked at and modified */
45 int apply
; /* this is not a dry-run */
46 int cached
; /* apply to the index only */
47 int check
; /* preimage must match working tree, don't actually apply */
48 int check_index
; /* preimage must match the indexed version */
49 int update_index
; /* check_index && apply */
50 int ita_only
; /* add intent-to-add entries to the index */
52 /* These control cosmetic aspect of the output */
53 int diffstat
; /* just show a diffstat, and don't actually apply */
54 int numstat
; /* just show a numeric diffstat, and don't actually apply */
55 int summary
; /* just report creation, deletion, etc, and don't actually apply */
57 /* These boolean parameters control how the apply is done */
60 int apply_with_reject
;
66 /* Other non boolean parameters */
67 struct repository
*repo
;
68 const char *index_file
;
69 enum apply_verbosity apply_verbosity
;
70 const char *fake_ancestor
;
71 const char *patch_input_file
;
76 unsigned int p_context
;
78 /* Exclude and include path parameters */
79 struct string_list limit_by_name
;
82 /* Various "current state" */
83 int linenr
; /* current line number */
84 struct string_list symlink_changes
; /* we have to track symlinks */
87 * For "diff-stat" like behaviour, we keep track of the biggest change
88 * we've seen, and the longest filename. That allows us to do simple
95 * Records filenames that have been touched, in order to handle
96 * the case where more than one patches touch the same file.
98 struct string_list fn_table
;
101 * This is to save reporting routines before using
102 * set_error_routine() or set_warn_routine() to install muting
103 * routines when in verbosity_silent mode.
105 void (*saved_error_routine
)(const char *err
, va_list params
);
106 void (*saved_warn_routine
)(const char *warn
, va_list params
);
108 /* These control whitespace errors */
109 enum apply_ws_error_action ws_error_action
;
110 enum apply_ws_ignore ws_ignore_action
;
111 const char *whitespace_option
;
112 int whitespace_error
;
113 int squelch_whitespace_errors
;
114 int applied_after_fixing_ws
;
117 int apply_parse_options(int argc
, const char **argv
,
118 struct apply_state
*state
,
119 int *force_apply
, int *options
,
120 const char * const *apply_usage
);
121 int init_apply_state(struct apply_state
*state
,
122 struct repository
*repo
,
124 void clear_apply_state(struct apply_state
*state
);
125 int check_apply_state(struct apply_state
*state
, int force_apply
);
128 * Some aspects of the apply behavior are controlled by the following
129 * bits in the "options" parameter passed to apply_all_patches().
131 #define APPLY_OPT_INACCURATE_EOF (1<<0) /* accept inaccurate eof */
132 #define APPLY_OPT_RECOUNT (1<<1) /* accept inaccurate line count */
134 int apply_all_patches(struct apply_state
*state
,
135 int argc
, const char **argv
,