summaryrefslogtreecommitdiff
path: root/apply.h
diff options
context:
space:
mode:
authorChristian Couder <christian.couder@gmail.com>2016-09-04 20:18:29 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-09-07 19:29:53 (GMT)
commit45b78d8ba3c9e542f1375171090fe10baef6b2b2 (patch)
tree285c8ce6701cc10b4f3c7b0f420cdd7435b39c5f /apply.h
parent725149beab088b1368cc01aa3f1a7845db14132d (diff)
downloadgit-45b78d8ba3c9e542f1375171090fe10baef6b2b2.zip
git-45b78d8ba3c9e542f1375171090fe10baef6b2b2.tar.gz
git-45b78d8ba3c9e542f1375171090fe10baef6b2b2.tar.bz2
apply: change error_routine when silent
To avoid printing anything when applying with `state->apply_verbosity == verbosity_silent`, let's save the existing warn and error routines before applying, and let's replace them with a routine that does nothing. Then after applying, let's restore the saved routines. Note that, as we need to restore the saved routines in all cases, we cannot return early any more in apply_all_patches(). Helped-by: Stefan Beller <sbeller@google.com> Signed-off-by: Christian Couder <chriscool@tuxfamily.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'apply.h')
-rw-r--r--apply.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/apply.h b/apply.h
index f015403..902346b 100644
--- a/apply.h
+++ b/apply.h
@@ -94,6 +94,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;